이 페이지에서는 위치 엔드포인트를 사용하도록 Datastore 모드의 Firestore 클라이언트 라이브러리를 구성하는 방법을 설명합니다.
Firestore in Datastore 모드 클라이언트 라이브러리를 사용하는 경우 다음 엔드포인트 중 하나를 사용할 수 있습니다.
전역 엔드포인트: 기본적으로 Firestore in Datastore 모드 클라이언트 라이브러리는 datastore.googleapis.com이라는 전역 서비스 엔드포인트에 API 요청을 전송합니다. 전역 서비스 엔드포인트는 요청을 데이터베이스로 라우팅합니다. 라우팅 중에는 요청이 데이터베이스 위치와 다른 위치의 위치별 서비스 엔드포인트를 통과할 수 있습니다.
위치 엔드포인트: 위치 엔드포인트는 데이터가 특정 리전에 저장 및 처리되도록 리전 제한을 적용합니다.
서비스 엔드포인트가 데이터베이스와 동일한 리전에서 앱의 Firestore in Datastore 모드 요청을 처리하도록 보장하려면 클라이언트 라이브러리에서 위치 엔드포인트를 지정합니다.
위치 엔드포인트 설정
다음 예시에서는 Firestore in Datastore 모드 클라이언트를 초기화할 때 위치 엔드포인트를 설정하는 방법을 보여줍니다.
Datastore 모드에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다.
자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.
importcom.google.cloud.datastore.Datastore;importcom.google.cloud.datastore.DatastoreOptions;publicclassRegionalEndpoint{publicDatastorecreateClient()throwsException{// Instantiates a clientDatastoreOptionsoptions=DatastoreOptions.newBuilder().setHost("https://nam5-datastore.googleapis.com").build();Datastoredatastore=options.getService();returndatastore;}}
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-08(UTC)"],[[["\u003cp\u003eFirestore in Datastore mode client libraries can use either a global endpoint (\u003ccode\u003edatastore.googleapis.com\u003c/code\u003e) or a regional endpoint to direct API requests.\u003c/p\u003e\n"],["\u003cp\u003eRegional endpoints ensure that data is processed and stored within the specified region, unlike the global endpoint which may route requests through different regions.\u003c/p\u003e\n"],["\u003cp\u003eTo set a regional endpoint, specify the regional endpoint URL during client initialization using the correct formatting, which varies slightly by language (Java, Python, Go).\u003c/p\u003e\n"],["\u003cp\u003eSetting the regional endpoint to a region where the data does not reside may cause a \u003ccode\u003ePermissionDeniedError\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eRegional endpoints use the format \u003ccode\u003ehttps://REGION_NAME-datastore.googleapis.com\u003c/code\u003e, with the full \u003ccode\u003ehttps\u003c/code\u003e URL and sometimes a port number required, replacing \u003ccode\u003eREGION_NAME\u003c/code\u003e with the appropriate location identifier, such as \u003ccode\u003eeur3\u003c/code\u003e or \u003ccode\u003enam5\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Configure data locality with locational endpoints\n\nThis page describes how to configure the Firestore in Datastore mode client libraries\nto use a locational endpoint.\n\nWhen you use Firestore in Datastore mode client libraries, you can use either of the following endpoints:\n\n- **Global endpoint** : By default, the Firestore in Datastore mode client libraries send API requests to a global\n service endpoint named `datastore.googleapis.com`. The global service endpoint\n routes the request to your database. During routing, the request\n might pass through a locational service endpoint in a location that's different\n from your database location.\n\n- **Locational endpoint** : A locational endpoint enforces regional restrictions, ensuring that data is stored and processed in a specified region.\n To guarantee that the service endpoint processes your app's Firestore in Datastore mode\n requests in the same region as your database, specify a *locational endpoint*\n in the client library.\n\nSet a locational endpoint\n-------------------------\n\nThe following examples show how to set a locational endpoint when you initialize\na Firestore in Datastore mode client.\n**Note:** Setting a locational endpoint other than where your data resides might result in a `PermissionDeniedError` error. \n\n### Java\n\n\nTo learn how to install and use the client library for Datastore mode, see\n[Datastore mode client libraries](/datastore/docs/reference/libraries).\n\n\nFor more information, see the\n[Datastore mode Java API\nreference documentation](https://cloud.google.com/java/docs/reference/google-cloud-datastore/latest/history).\n\n\nTo authenticate to Datastore mode, 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\n import com.google.cloud.datastore.https://cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.cloud.datastore.Datastore.html;\n import com.google.cloud.datastore.https://cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.cloud.datastore.DatastoreOptions.html;\n\n public class RegionalEndpoint {\n\n public https://cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.cloud.datastore.Datastore.html createClient() throws Exception {\n // Instantiates a client\n https://cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.cloud.datastore.DatastoreOptions.html options =\n https://cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.cloud.datastore.DatastoreOptions.html.newBuilder().https://cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.cloud.datastore.DatastoreOptions.Builder.html#com_google_cloud_datastore_DatastoreOptions_Builder_setHost_java_lang_String_(\"https://nam5-datastore.googleapis.com\").build();\n https://cloud.google.com/java/docs/reference/google-cloud-datastore/latest/com.google.cloud.datastore.Datastore.html datastore = options.getService();\n return datastore;\n }\n }\n\n### Python\n\n\nTo learn how to install and use the client library for Datastore mode, see\n[Datastore mode client libraries](/datastore/docs/reference/libraries).\n\n\nFor more information, see the\n[Datastore mode Python API\nreference documentation](https://cloud.google.com/python/docs/reference/datastore/latest).\n\n\nTo authenticate to Datastore mode, 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 ENDPOINT = \"https://eur3-datastore.googleapis.com\"\n client_options = ClientOptions(api_endpoint=ENDPOINT)\n client = datastore.Client(client_options=client_options)\n\n query = client.query(kind=\"Task\")\n results = list(query.fetch())\n for r in results:\n print(r)\n\n\u003cbr /\u003e\n\n### Locational endpoint semantics\n\nFirestore in Datastore mode supports locational endpoints for both region and multi-region locations.\n\nUse the following format to define locational endpoints: \n\n### Java\n\n https://\u003cvar translate=\"no\"\u003eREGION_NAME\u003c/var\u003e-firestore.googleapis.com:443\n\nMake sure that the complete `https` URL is used and that the port number is defined along with the endpoint.\n\n### Python\n\n https://\u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-n\"\u003eREGION_NAME\u003c/span\u003e\u003c/var\u003e-firestore.googleapis.com\n\nMake sure that the complete `https` URL is set as the locational endpoint.\n\n### Go\n\n \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-nx\"\u003eREGION_NAME\u003c/span\u003e\u003c/var\u003e-firestore.googleapis.com:443\n\nMake sure that the port number is defined along with the endpoint.\n\nReplace \u003cvar translate=\"no\"\u003eREGION_NAME\u003c/var\u003e with the name of a regional or multi-regional hostnames.\n\nSome examples of hostnames are:\n\n- `eur3-datastore.googleapis.com`\n- `nam5-datastore.googleapis.com`\n- `europe-west6-datastore.googleapis.com`\n- `asia-northeast2-datastore.googleapis.com`\n\nFor a complete list of multi-regional and regional hostnames, see [Firestore in Datastore mode locations](/datastore/docs/locations).\n\nWhat's next\n-----------\n\n- Learn about the Firestore in Datastore mode data model. See [Entities, properties, and keys](/datastore/docs/concepts/entities).\n- See the [Best practices](/datastore/docs/best-practices) for Firestore in Datastore mode."]]