복제된 클러스터 만들기
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
현재 프로젝트에서 복제된 클러스터를 만듭니다.
코드 샘플
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],[],[[["\u003cp\u003eThis content demonstrates how to create a replicated cluster within a Google Cloud project using the Bigtable client library for C++.\u003c/p\u003e\n"],["\u003cp\u003eThe code utilizes the \u003ccode\u003eBigtableInstanceAdminClient\u003c/code\u003e to create an instance with a production type and a specified display name.\u003c/p\u003e\n"],["\u003cp\u003eThe example sets up two clusters, \u003ccode\u003ecluster1\u003c/code\u003e and \u003ccode\u003ecluster2\u003c/code\u003e, in different zones (\u003ccode\u003ezone_a\u003c/code\u003e and \u003ccode\u003ezone_b\u003c/code\u003e), each with three serve nodes and HDD storage.\u003c/p\u003e\n"],["\u003cp\u003eAuthentication to Bigtable requires setting up Application Default Credentials, as detailed in the provided documentation link.\u003c/p\u003e\n"],["\u003cp\u003eThe provided code will create an instance asynchronously, and waits until the operation is complete to display the results.\u003c/p\u003e\n"]]],[],null,["Create a replicated cluster in the current project.\n\nCode sample \n\nC++\n\n\nTo learn how to install and use the client library for Bigtable, see\n[Bigtable client libraries](/bigtable/docs/reference/libraries).\n\n\nTo authenticate to Bigtable, set up Application Default Credentials.\nFor more information, see\n\n[Set up authentication for a local development environment](/docs/authentication/set-up-adc-local-dev-environment).\n\n namespace cbta = ::google::cloud::bigtable_admin;\n using ::google::cloud::future;\n using ::google::cloud::Location;\n using ::google::cloud::Project;\n using ::google::cloud::StatusOr;\n\n [](cbta::BigtableInstanceAdminClient instance_admin,\n std::string const& project_id, std::string const& instance_id,\n std::string const& zone_a, std::string const& zone_b) {\n auto const project = Project(project_id);\n std::string project_name = project.FullName();\n std::string c1 = instance_id + \"-c1\";\n std::string c2 = instance_id + \"-c2\";\n\n google::bigtable::admin::v2::Instance in;\n in.set_type(google::bigtable::admin::v2::Instance::PRODUCTION);\n in.set_display_name(\"Put description here\");\n\n google::bigtable::admin::v2::Cluster cluster1;\n cluster1.set_location(Location(project, zone_a).FullName());\n cluster1.set_serve_nodes(3);\n cluster1.set_default_storage_type(google::bigtable::admin::v2::HDD);\n\n google::bigtable::admin::v2::Cluster cluster2;\n cluster2.set_location(Location(project, zone_b).FullName());\n cluster2.set_serve_nodes(3);\n cluster2.set_default_storage_type(google::bigtable::admin::v2::HDD);\n\n std::map\u003cstd::string, google::bigtable::admin::v2::Cluster\u003e cluster_map = {\n {c1, std::move(cluster1)}, {c2, std::move(cluster2)}};\n\n future\u003cStatusOr\u003cgoogle::bigtable::admin::v2::Instance\u003e\u003e instance_future =\n instance_admin.CreateInstance(project_name, instance_id, std::move(in),\n std::move(cluster_map));\n // Show how to perform additional work while the long running operation\n // completes. The application could use future.then() instead.\n std::cout \u003c\u003c \"Waiting for instance creation to complete \" \u003c\u003c std::flush;\n instance_future.wait_for(std::chrono::seconds(1));\n std::cout \u003c\u003c '.' \u003c\u003c std::flush;\n auto instance = instance_future.get();\n if (!instance) throw std::move(instance).status();\n std::cout \u003c\u003c \"DONE, details=\" \u003c\u003c instance-\u003eDebugString() \u003c\u003c \"\\n\";\n }\n\nWhat's next\n\n\nTo search and filter code samples for other Google Cloud products, see the\n[Google Cloud sample browser](/docs/samples?product=bigtable)."]]