Datastore 모드의 Firestore PITR(point-in-time recovery)은 실수로 인한 삭제나 쓰기를 방지합니다. PITR은 이전 타임스탬프의 항목 버전을 유지합니다. 예를 들어 개발자가 잘못된 데이터, 실수로 인한 삭제 또는 쓰기를 푸시하는 경우 PITR을 통해 과거의 특정 시점(최대 7일)의 데이터를 원활하게 복구할 수 있습니다.
권장사항을 따르는 모든 실시간 데이터베이스의 경우 PITR을 사용해도 읽기 또는 쓰기 성능은 영향을 받지 않습니다.
PITR 기간
PITR을 사용 설정하면 Datastore 모드에서 PITR 데이터를 보관하기 시작합니다. PITR 데이터는 PITR 기간 중 7일 동안 보관됩니다.
PITR이 사용 설정된 시간을 기반으로 타임스탬프의 데이터를 읽을 수 있습니다.
PITR 사용 설정 상태
사용 가능한 가장 이른 PITR 데이터
사용 중지됨
읽기 요청 시간 1시간 전
7일 이내에 사용 설정됨
PITR이 사용 설정되기 1시간 전
7일 이전에 사용 설정됨
읽기 요청 시간 7일 전
분당 단일 버전이 PITR 기간에 보관됩니다. 1분 타임스탬프를 사용하여 분 단위로 문서를 읽을 수 있습니다. 쓰기가 여러 개인 경우 문서 버전 하나만 유지됩니다. 예를 들어 문서에 2023-05-30 09:00:00AM(제외) 및 2023-05-30 09:01:00AM(포함) 타임스탬프 사이에 v1, v2, ... vk에 이르는 여러 개의 쓰기가 있는 경우, 타임스탬프 2023-05-30 09:01:00AM의 읽기 요청이 문서의 vk 버전을 반환합니다.
PITR 기간 중 생성된 데이터를 읽을 수 있습니다. 데이터는 분 단위로 저장되며 동일한 단위로 데이터를 복구할 수 있습니다. Datastore 모드 PITR 기능은 기본적으로 사용 중지되어 있습니다.
PITR의 사용 설정 여부와 관계없이 지난 1시간 이내의 마이크로초 단위 타임스탬프에서 문서를 읽을 수 있지만 내보낼 수는 없습니다. 단, earliestVersionTime 이전에서 읽을 수 없습니다.
데이터 복구 방법
데이터를 복구하는 방법에는 두 가지가 있습니다.
데이터베이스의 일부를 복구하려면 쿼리 조건을 지정하거나 이전의 타임스탬프와 함께 직접 키 조회를 사용하여 비활성 읽기를 수행합니다. 그런 다음 결과를 다시 실시간 데이터베이스에 기록합니다. 이는 일반적으로 실시간 데이터베이스의 소위 외과적 수술을 위해 사용됩니다.
예를 들어 특정 항목을 실수로 삭제하거나 데이터 하위 집합을 잘못 업데이트한 경우 이와 같은 방법으로 복구할 수 있습니다.
자세한 내용은 일부 데이터베이스 복구를 참조하세요.
[[["이해하기 쉬움","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-05(UTC)"],[[["\u003cp\u003eFirestore in Datastore mode's point-in-time recovery (PITR) feature protects against accidental data deletion or incorrect writes by retaining versions of entities for up to 7 days, allowing for seamless data recovery.\u003c/p\u003e\n"],["\u003cp\u003eEnabling PITR does not affect the performance of reads or writes for live databases that adhere to best practices.\u003c/p\u003e\n"],["\u003cp\u003ePITR data is retained for 7 days, and data can be read at minute granularity within this window, where the availability of data depends on when PITR was enabled, with the earliest available data ranging from 1 hour before a read request to 7 days prior.\u003c/p\u003e\n"],["\u003cp\u003eData can be recovered either by performing stale reads on a portion of the database and writing it back or by exporting the entire database to a specific point in time and importing it into a new database.\u003c/p\u003e\n"],["\u003cp\u003eUsing PITR incurs storage and compute costs, with storage measured daily and averaged monthly, and read operation costs for any queries within the 7-day PITR window, additionally there is a potential charge for up to 1 day of storage even if the feature is turned off quickly.\u003c/p\u003e\n"]]],[],null,["# Point-in-time recovery (PITR) overview\n\nFirestore in Datastore mode point-in-time recovery (PITR) provides protection against\naccidental deletion or writes. PITR maintains versions of your\nentities from past timestamps. For example, in the case of a developer\npushing the incorrect data, accidental deletes or writes, PITR can recover the\ndata to a point in time in the past (up to a maximum of 7 days) seamlessly.\n\nFor any live database that follows [Best practices](./best-practices), use\nof PITR doesn't affect the performance of reads or writes.\n\nPITR window\n-----------\n\nAfter you enable PITR, Datastore mode starts retaining PITR data. PITR data is\nretained for 7 days in the PITR window.\n\nYou can read data for a timestamp based on when PITR was enabled:\n\n| **Note:** You can't start reading from seven days in the past immediately after you enable PITR.\n\nA single version per minute is retained in the PITR window. You can read documents at minute\ngranularity using a whole minute timestamp. Only one version of a document is\nretained in case of multiple writes. For example, if a document had multiple\nwrites ranging from `v1, v2, ... vk` between `2023-05-30 09:00:00AM` (exclusive)\nand `2023-05-30 09:01:00AM` (inclusive) timestamp, a read request at timestamp\n`2023-05-30 09:01:00AM` returns the `vk` version of the document.\n\nYou can read from the data created during the PITR\nwindow. The data is stored at a minute granularity and you can recover data\nat the same granularity. Datastore mode PITR feature is disabled by default.\n\nThe [earliestVersionTime](/firestore/docs/reference/rest/v1/projects.databases#resource:-database) field of your database specifies the\nearliest permissible read time for your data.\n\nRegardless of whether PITR is enabled or not, you can read (but not export) documents at any microsecond-granularity timestamp within the past hour, but not before the earliestVersionTime.\n\nWays to recover data\n--------------------\n\nThere are two ways to recover data:\n\n- To **recover a portion of the database** , perform a [stale read](/firestore/docs/understand-reads-writes-scale#stale_reads)\n specifying a query-condition or using direct key lookup along with a\n timestamp in the past, and then write the results back into the live\n database. This is typically used for surgical operations on a live database.\n For example, if you accidentally delete a particular entity or\n incorrectly update a subset of data, you can recover it with this method.\n For instructions, see [recovering a portion of your database](/datastore/docs/use-pitr#read-pitr).\n\n- To **recover the entire database** , [export](/datastore/docs/use-pitr#export-import) the database specifying\n a timestamp in the past and then import it to a new database. The PITR\n export operation supports all filters, including export of all entities\n and export of specific kinds or namespaces. Note that exporting a database could\n take several hours. You can export PITR data where the timestamp is a whole\n minute timestamp within the past seven days, but not earlier than the\n earliestVersionTime.\n\nPricing\n-------\n\nConsider the following pricing information before you enable PITR for your database:\n\n- Storage: Datastore mode measures the database size daily. Over the\n period of a month, these sample points are averaged to calculate the\n database storage size. This average value is multiplied by the unit price of\n PITR (GB-month). See the [storage pricing](/firestore/pricing) for more information.\n\n PITR storage doesn't have a free tier and you must have billing enabled if you\n want to use PITR.\n- Compute billing: Any queries that you make during the PITR window of 7 days,\n either through stale reads or exports, incur read operation costs\n based on the number of documents read. See [pricing](/firestore/pricing) for more\n information.\n\n- Minimum billing: You may be charged up to 1 day of PITR storage cost even if\n you disable PITR within a day after enablement.\n\nWhat's next\n-----------\n\n- Learn more about how to [recover data with PITR](/datastore/docs/use-pitr)."]]