패브릭 미러링에 대한 공용 API는 (1) 패브릭 미러된 데이터베이스 항목에 대한 CRUD 작업 과 (2) 시작/중지 및 모니터링 작업의 두 가지 범주로 구성됩니다. Microsoft Fabric REST API에 대한 기본 온라인 참조 설명서는 Microsoft Fabric REST API 참조에서 찾을 수 있습니다.
비고
이러한 REST API는 Azure Databricks의 미러된 데이터베이스에 적용되지 않습니다.
미러된 데이터베이스 만들기
REST API - 항목 - 미러된 데이터베이스 만들기
미러된 데이터베이스를 만들기 전에 해당 데이터 원본 연결이 필요합니다. 아직 연결이 없는 경우 포털을 사용하여 새 연결 만들기 를 참조하고 다음 정의에서 해당 연결 ID를 사용합니다. 패브릭 REST API를 사용하여 새 연결을 만들려면 새 연결 생성 REST API를 참조하십시오.
예제:
POST https://api.fabric.microsoft.com/v1/workspaces/<your workspace ID>/mirroredDatabases
본문:
{
"displayName": "Mirrored database 1",
"description": "A mirrored database description",
"definition": {
"parts": [
{
"path": "mirroring.json",
"payload": "eyAicHJvcGVydGllcy..WJsZSIgfSB9IH0gXSB9IH0",
"payloadType": "InlineBase64"
}
]
}
}
payload 이전 JSON 본문의 속성은 Base64로 인코딩됩니다.
Base64 인코딩 및 디코딩을 사용하여 인코딩할 수 있습니다.
원래 JSON 정의 예제는 다음과 같습니다. 정의 구조의 분석을 포함하여 미러된 데이터베이스 항목 정의에 대한 자세한 내용은 미러된 데이터베이스 항목 정의를 참조하세요. 미러된 데이터베이스 정의 가져오기 API를 호출하여 기존 미러된 데이터베이스의 정의를 참조할 수도 있습니다.
중요합니다
Azure SQL Database, Azure SQL Managed Instance, Azure Database for PostgreSQL 또는 SQL Server 2025에서 데이터를 미러링하려면 미러링을 시작하기 전에 다음을 수행해야 합니다.
- Azure SQL 논리 서버, Azure SQL Managed Instance, Azure Database for PostgreSQL, SQL Server의 관리 ID를 사용하도록 설정합니다.
- 미러된 데이터베이스에 관리 ID 읽기 및 쓰기 권한을 부여합니다. 현재 Fabric 포털에서 이 작업을 수행해야 합니다. 또는 작업 영역 역할 할당 추가 API를 사용하여 관리 ID 작업 영역 역할을 부여할 수 있습니다.
비고
미러된 deafultSchema 데이터베이스에서 원본 스키마 계층 구조를 유지하도록 속성을 설정합니다.
전체 데이터베이스를 복제하는 JSON 정의 예제
원본 데이터베이스의 모든 테이블을 미러링하려면 다음을 수행합니다.
{
"properties": {
"source": {
"type": "<your source type>",
"typeProperties": {
"connection": "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"database": "xxxx"
}
},
"target": {
"type": "MountedRelationalDatabase",
"typeProperties": {
"defaultSchema": "xxxx",
"format": "Delta"
}
}
}
}
지정된 테이블을 복제하는 JSON 정의 예제
원본 데이터베이스에서 선택적 테이블을 미러링하려면 다음 예제와 같이 속성을 지정할 mountedTables 수 있습니다.
{
"properties": {
"source": {
"type": "<your source type>",
"typeProperties": {
"connection": "a0a0a0a0-bbbb-cccc-dddd-e1e1e1e1e1e1",
"database": "xxxx"
}
},
"target": {
"type": "MountedRelationalDatabase",
"typeProperties": {
"defaultSchema": "xxxx",
"format": "Delta"
}
},
"mountedTables": [
{
"source": {
"typeProperties": {
"schemaName": "xxxx",
"tableName": "xxxx"
}
}
}
]
}
}
응답 201:
{
"id": "<mirrored database ID>",
"type": "MirroredDatabase",
"displayName": "Mirrored database 1",
"description": "A mirrored database description",
"workspaceId": "<your workspace ID>"
}
미러된 데이터베이스 삭제
예제:
DELETE https://api.fabric.microsoft.com/v1/workspaces/<your workspace ID>/mirroredDatabases/<mirrored database ID>
응답 200: (본문 없음)
미러된 데이터베이스 가져오기
REST API - 항목 - 미러된 데이터베이스 가져오기
예제:
GET https://api.fabric.microsoft.com/v1/workspaces/<your workspace ID>/mirroredDatabases/<mirrored database ID>
응답 200:
{
"displayName": "Mirrored database 1",
"description": "A mirrored database description.",
"type": "MirroredDatabase",
"workspaceId": "<your workspace ID>",
"id": "<mirrored database ID>",
"properties": {
"oneLakeTablesPath": "https://onelake.dfs.fabric.microsoft.com/<your workspace ID>/<mirrored database ID>/Tables",
"sqlEndpointProperties": {
"connectionString": "xxxx.xxxx.fabric.microsoft.com",
"id": "b1b1b1b1-cccc-dddd-eeee-f2f2f2f2f2f2",
"provisioningStatus": "Success"
},
"defaultSchema": "xxxx"
}
}
미러된 데이터베이스 정의 가져오기
REST API - 항목 - 미러된 데이터베이스 정의 가져오기
예제:
POST https://api.fabric.microsoft.com/v1/workspaces/<your workspace ID>/mirroredDatabases/<mirrored database ID>/getDefinition
응답 200:
{
"definition": {
"parts":[
{
"path": "mirroring.json",
"payload": "eyAicHJvcGVydGllcy..WJsZSIgfSB9IH0gXSB9IH0",
"payloadType": "InlineBase64"
}
]
}
}
미러된 데이터베이스 나열
예제:
GET https://api.fabric.microsoft.com/v1/workspaces/<your workspace ID>/mirroredDatabases
응답 200:
{
"value": [
{
"displayName": "Mirrored database 1",
"description": "A mirrored database description.",
"type": "MirroredDatabase",
"workspaceId": "<your workspace ID>",
"id": "<mirrored database ID>",
"properties": {
"oneLakeTablesPath": "https://onelake.dfs.fabric.microsoft.com/<your workspace ID>/<mirrored database ID>/Tables",
"sqlEndpointProperties": {
"connectionString": "xxxx.xxxx.fabric.microsoft.com",
"id": "b1b1b1b1-cccc-dddd-eeee-f2f2f2f2f2f2",
"provisioningStatus": "Success"
},
"defaultSchema": "xxxx"
}
}
]
}
미러된 데이터베이스 업데이트
REST API - 항목 - 미러된 데이터베이스 업데이트
예제:
PATCH https://api.fabric.microsoft.com/v1/workspaces/<your workspace ID>/mirroredDatabases/<mirrored database ID>
본문:
{
"displayName": "MirroredDatabase's New name",
"description": "A new description for mirrored database."
}
응답 200:
{
"displayName": "MirroredDatabase's New name",
"description": "A new description for mirrored database.",
"type": "MirroredDatabase",
"workspaceId": "<your workspace ID>",
"id": "<mirrored database ID>"
}
미러된 데이터베이스 정의 업데이트
REST API - 항목 - 미러된 데이터베이스 정의 업데이트
예제:
POST https://api.fabric.microsoft.com/v1/workspaces/<your workspace ID>/mirroredDatabases/<mirrored database ID>/updateDefinition
본문:
{
"definition": {
"parts": [
{
"path": "mirroring.json",
"payload": "eyAicHJvcGVydGllcy..WJsZSIgfSB9IH0gXSB9IH0",
"payloadType": "InlineBase64"
}
]
}
}
응답 200: (본문 없음)
이전 JSON 본문의 페이로드 속성은 Base64로 인코딩됩니다. Base64 인코딩 및 디코딩을 사용하여 인코딩할 수 있습니다.
비고
이 API는 속성을 새로 고쳐 테이블 추가/제거를 지원합니다 mountedTables . 또한 원본 연결 ID, 데이터베이스 이름 및 기본 스키마 업데이트를 지원합니다(이 세 가지 속성은 미러링 상태 가져오기 API가 반환 Initialized/Stopped될 때만 업데이트할 수 있음).
데이터 보존 구성
속성을 사용하여 retentionInDays 설정할 수 있습니다. 기본값은 7일입니다. 허용되는 값은 1에서 30 사이의 정수입니다.
Base64 인코딩 이전의 JSON 정의 예제:
{
"properties": {
"source": {...},
"target": {
"type": "MountedRelationalDatabase",
"typeProperties": {
"defaultSchema": "xxxx",
"format": "Delta",
"retentionInDays": 1
}
}
}
}
미러링 상태 가져오기
이 API는 미러된 데이터베이스 인스턴스의 상태를 반환합니다. 사용 가능한 상태 목록은 MirroringStatus 값으로 제공됩니다.
예제:
POST https://api.fabric.microsoft.com/v1/workspaces/<your workspace ID>/mirroredDatabases/<mirrored database ID>/getMirroringStatus
응답 200:
{
"status": "Running"
}
미러링 시작
예제:
POST https://api.fabric.microsoft.com/v1/workspaces/<your workspace ID>/mirroredDatabases/<mirrored database ID>/startMirroring
응답 200: (본문 없음)
비고
미러링 상태 가져오기 API가 상태를 반환 Initializing 하는 경우 미러링을 시작할 수 없습니다.
테이블 미러링 상태 가져오기
REST API - 미러링 - 테이블 미러링 상태 가져오기
미러링이 시작되고 미러링 상태 가져오기 API가 상태를 반환 Running 하는 경우 이 API는 테이블 복제의 상태 및 메트릭을 반환합니다.
예제:
POST https://api.fabric.microsoft.com/v1/workspaces/<your workspace ID>/mirroredDatabases/<mirrored database ID>/getTablesMirroringStatus
응답 200:
{
"continuationToken": null,
"continuationUri": null,
"data": [
{
"sourceSchemaName": "dbo",
"sourceTableName": "test",
"status": "Replicating",
"metrics": {
"processedBytes": 1247,
"processedRows": 6,
"lastSyncDateTime": "2024-10-08T05:07:11.0663362Z"
}
}
]
}
미러링 중지
예제:
POST https://api.fabric.microsoft.com/v1/workspaces/<your workspace ID>/mirroredDatabases/<mirrored database ID>/stopMirroring
응답 200: (본문 없음)
비고
미러링을 중지한 후 미러링 상태 가져오기 API를 호출하여 미러링 상태를 쿼리할 수 있습니다.
Microsoft Fabric .NET SDK
패브릭 미러링을 지원하는 .NET SDK는 Microsoft Fabric .NET SDK에서 사용할 수 있습니다. 버전은 = 1.0.0-beta.11이어야 >합니다.