- 新しいGeoノードの作成
- すべての Geo ノードの設定を取得します。
- 特定の Geo ノードに関する設定を取得します。
- Geoノードの編集
- Geoノードの削除
- Geoノードの修復
- すべての Geo ノードのステータスの取得
- 特定の Geo ノードに関するステータスの取得
- 現在のノードで発生したプロジェクトの同期または検証の失敗を取得します。
Geo Nodes API
Geo ノードエンドポイントとやり取りするには、管理者として認証する必要があります。
新しいGeoノードの作成
新しい Geo ノードを作成します。
POST /geo_nodes
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_nodes" \
--request POST \
-d "name=himynameissomething" \
-d "url=https://another-node.example.com/"
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
primary
| ブーリアン | いいえ | このノードをプライマリにするかどうかを指定します。 デフォルトは false です。 |
enabled
| ブーリアン | いいえ | Geoノードが有効かどうかを示すフラグ。 デフォルトはtrue。 |
name
| 列 | はい | Geo ノードの一意な識別子。gitlab.rb で設定されている場合はgeo_node_name と一致する必要があり、そうでない場合はexternal_url
|
url
| 列 | はい | Geoノードのユーザー向けURL。 |
internal_url
| 列 | いいえ | セカンダリノードがプライマリノードとの連絡に使用する、プライマリノードで定義された URL。設定されていない場合はurl を返します。
|
files_max_capacity
| 整数 | いいえ | このセカンダリノードのLFS/アタッチメントバックフィルの最大同時実行数を制御します。 デフォルトは10です。 |
repos_max_capacity
| 整数 | いいえ | このセカンダリノードのリポジトリバックフィルの最大同時実行数を制御します。 デフォルトは 25 です。 |
verification_max_capacity
| 整数 | いいえ | このノードのリポジトリ検証の最大同時実行数を制御します。 デフォルトは 100 です。 |
container_repositories_max_capacity
| 整数 | いいえ | このノードのコンテナリポジトリ同期の最大同時実行数を制御します。 デフォルトは 10 です。 |
sync_object_storage
| ブーリアン | いいえ | セカンダリ Geo ノードが Object Storage にブロブをレプリケートするかどうかを示すフラグ。 デフォルトは false。 |
selective_sync_type
| 列 | いいえ | 特定のグループまたはシャードのみに同期を制限します。 有効な値:"namespaces" 、"shards" 、またはnull 。
|
selective_sync_shards
| アレイ | いいえ |
selective_sync_type ==shards の場合、同期されたプロジェクトのリポジトリストレージ。
|
selective_sync_namespace_ids
| アレイ | いいえ |
selective_sync_type ==namespaces の場合、同期されるべきグループのID。
|
minimum_reverification_interval
| 整数 | いいえ | リポジトリの検証が有効である間隔(日単位)。 有効期限が切れると、再度検証されます。 セカンダリノードで設定しても効果はありません。 |
回答例
{
"id": 3,
"name": "Test Node 1",
"url": "https://secondary.example.com/",
"internal_url": "https://secondary.example.com/",
"primary": false,
"enabled": true,
"current": false,
"files_max_capacity": 10,
"repos_max_capacity": 25,
"verification_max_capacity": 100,
"selective_sync_type": "namespaces",
"selective_sync_shards": [],
"selective_sync_namespace_ids": [1, 25],
"minimum_reverification_interval": 7,
"container_repositories_max_capacity": 10,
"sync_object_storage": false,
"clone_protocol": "http",
"web_edit_url": "https://primary.example.com/admin/geo/nodes/3/edit",
"web_geo_projects_url": "http://secondary.example.com/admin/geo/projects",
"_links": {
"self": "https://primary.example.com/api/v4/geo_nodes/3",
"status": "https://primary.example.com/api/v4/geo_nodes/3/status",
"repair": "https://primary.example.com/api/v4/geo_nodes/3/repair"
}
}
すべての Geo ノードの設定を取得します。
GET /geo_nodes
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_nodes"
回答例
[
{
"id": 1,
"name": "us-node",
"url": "https://primary.example.com/",
"internal_url": "https://internal.example.com/",
"primary": true,
"enabled": true,
"current": true,
"files_max_capacity": 10,
"repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100,
"selective_sync_type": "namespaces",
"selective_sync_shards": [],
"selective_sync_namespace_ids": [1, 25],
"minimum_reverification_interval": 7,
"clone_protocol": "http",
"web_edit_url": "https://primary.example.com/admin/geo/nodes/1/edit",
"_links": {
"self": "https://primary.example.com/api/v4/geo_nodes/1",
"status":"https://primary.example.com/api/v4/geo_nodes/1/status",
"repair":"https://primary.example.com/api/v4/geo_nodes/1/repair"
}
},
{
"id": 2,
"name": "cn-node",
"url": "https://secondary.example.com/",
"internal_url": "https://secondary.example.com/",
"primary": false,
"enabled": true,
"current": false,
"files_max_capacity": 10,
"repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100,
"selective_sync_type": "namespaces",
"selective_sync_shards": [],
"selective_sync_namespace_ids": [1, 25],
"minimum_reverification_interval": 7,
"sync_object_storage": true,
"clone_protocol": "http",
"web_edit_url": "https://primary.example.com/admin/geo/nodes/2/edit",
"web_geo_projects_url": "https://secondary.example.com/admin/geo/projects",
"_links": {
"self":"https://primary.example.com/api/v4/geo_nodes/2",
"status":"https://primary.example.com/api/v4/geo_nodes/2/status",
"repair":"https://primary.example.com/api/v4/geo_nodes/2/repair"
}
}
]
特定の Geo ノードに関する設定を取得します。
GET /geo_nodes/:id
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_nodes/1"
回答例
{
"id": 1,
"name": "us-node",
"url": "https://primary.example.com/",
"internal_url": "https://primary.example.com/",
"primary": true,
"enabled": true,
"current": true,
"files_max_capacity": 10,
"repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100,
"selective_sync_type": "namespaces",
"selective_sync_shards": [],
"selective_sync_namespace_ids": [1, 25],
"minimum_reverification_interval": 7,
"clone_protocol": "http",
"web_edit_url": "https://primary.example.com/admin/geo/nodes/1/edit",
"_links": {
"self": "https://primary.example.com/api/v4/geo_nodes/1",
"status":"https://primary.example.com/api/v4/geo_nodes/1/status",
"repair":"https://primary.example.com/api/v4/geo_nodes/1/repair"
}
}
Geoノードの編集
既存の Geo ノードの設定を更新します。
これはプライマリ Geo ノードに対してのみ実行できます。
PUT /geo_nodes/:id
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数 | はい | Geo ノードの ID。 |
enabled
| ブーリアン | いいえ | Geo ノードが有効かどうかを示すフラグ。 |
name
| 列 | はい | Geo ノードの一意識別子。gitlab.rb で設定されている場合はgeo_node_name と一致する必要があり、そうでない場合はexternal_url と一致する必要があります。
|
url
| 列 | はい | Geoノードのユーザー向けURL。 |
internal_url
| 列 | いいえ | セカンダリノードがプライマリノードとの連絡に使用する、プライマリノードで定義された URL。設定されていない場合はurl を返します。
|
files_max_capacity
| 整数 | いいえ | このセカンダリノードのLFS/アタッチメントバックフィルの最大同時実行数を制御します。 |
repos_max_capacity
| 整数 | いいえ | このセカンダリノードのリポジトリバックフィルの最大同時実行数を制御します。 |
verification_max_capacity
| 整数 | いいえ | このノードの検証の最大同時実行数を制御します。 |
container_repositories_max_capacity
| 整数 | いいえ | このノードのコンテナリポジトリ同期の最大同時実行数を制御します。 |
sync_object_storage
| ブーリアン | いいえ | セカンダリ Geo ノードが Object Storage にブロブをレプリケートするかどうかを示すフラグ。 |
selective_sync_type
| 列 | いいえ | 特定のグループまたはシャードのみに同期を制限します。 有効な値:"namespaces" 、"shards" 、またはnull 。
|
selective_sync_shards
| アレイ | いいえ |
selective_sync_type ==shards の場合、同期されたプロジェクトのリポジトリストレージ。
|
selective_sync_namespace_ids
| アレイ | いいえ |
selective_sync_type ==namespaces の場合、同期されるべきグループのID。
|
minimum_reverification_interval
| 整数 | いいえ | リポジトリの検証が有効である間隔(日単位)。 有効期限が切れると、再度検証されます。 セカンダリノードで設定しても効果はありません。 |
回答例
{
"id": 1,
"name": "cn-node",
"url": "https://secondary.example.com/",
"internal_url": "https://secondary.example.com/",
"primary": false,
"enabled": true,
"current": true,
"files_max_capacity": 10,
"repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100,
"selective_sync_type": "namespaces",
"selective_sync_shards": [],
"selective_sync_namespace_ids": [1, 25],
"minimum_reverification_interval": 7,
"sync_object_storage": true,
"clone_protocol": "http",
"web_edit_url": "https://primary.example.com/admin/geo/nodes/2/edit",
"web_geo_projects_url": "https://secondary.example.com/admin/geo/projects",
"_links": {
"self":"https://primary.example.com/api/v4/geo_nodes/2",
"status":"https://primary.example.com/api/v4/geo_nodes/2/status",
"repair":"https://primary.example.com/api/v4/geo_nodes/2/repair"
}
}
Geoノードの削除
Geo ノードを削除します。
注意:Geoプライマリ・ノードのみがこのリクエストを受け付けます。
DELETE /geo_nodes/:id
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
id
| 整数 | はい | Geo ノードの ID。 |
Geoノードの修復
Geo ノードの OAuth 認証を修復します。
これはプライマリ Geo ノードに対してのみ実行できます。
POST /geo_nodes/:id/repair
回答例
{
"id": 1,
"name": "us-node",
"url": "https://primary.example.com/",
"internal_url": "https://primary.example.com/",
"primary": true,
"enabled": true,
"current": true,
"files_max_capacity": 10,
"repos_max_capacity": 25,
"container_repositories_max_capacity": 10,
"verification_max_capacity": 100,
"clone_protocol": "http",
"web_edit_url": "https://primary.example.com/admin/geo/nodes/1/edit",
"_links": {
"self": "https://primary.example.com/api/v4/geo_nodes/1",
"status":"https://primary.example.com/api/v4/geo_nodes/1/status",
"repair":"https://primary.example.com/api/v4/geo_nodes/1/repair"
}
}
すべての Geo ノードのステータスの取得
GET /geo_nodes/status
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_nodes/status"
回答例
[
{
"geo_node_id": 1,
"healthy": true,
"health": "Healthy",
"health_status": "Healthy",
"missing_oauth_application": false,
"attachments_count": 1,
"attachments_synced_count": nil,
"attachments_failed_count": nil,
"attachments_synced_missing_on_primary_count": 0,
"attachments_synced_in_percentage": "0.00%",
"db_replication_lag_seconds": nil,
"lfs_objects_count": 0,
"lfs_objects_synced_count": nil,
"lfs_objects_failed_count": nil,
"lfs_objects_synced_missing_on_primary_count": 0,
"lfs_objects_synced_in_percentage": "0.00%",
"job_artifacts_count": 2,
"job_artifacts_synced_count": nil,
"job_artifacts_failed_count": nil,
"job_artifacts_synced_missing_on_primary_count": 0,
"job_artifacts_synced_in_percentage": "0.00%",
"container_repositories_count": 3,
"container_repositories_synced_count": nil,
"container_repositories_failed_count": nil,
"container_repositories_synced_in_percentage": "0.00%",
"design_repositories_count": 3,
"design_repositories_synced_count": nil,
"design_repositories_failed_count": nil,
"design_repositories_synced_in_percentage": "0.00%",
"projects_count": 41,
"repositories_failed_count": nil,
"repositories_synced_count": nil,
"repositories_synced_in_percentage": "0.00%",
"wikis_failed_count": nil,
"wikis_synced_count": nil,
"wikis_synced_in_percentage": "0.00%",
"replication_slots_count": 1,
"replication_slots_used_count": 1,
"replication_slots_used_in_percentage": "100.00%",
"replication_slots_max_retained_wal_bytes": 0,
"repositories_checked_count": 20,
"repositories_checked_failed_count": 20,
"repositories_checked_in_percentage": "100.00%",
"repositories_checksummed_count": 20,
"repositories_checksum_failed_count": 5,
"repositories_checksummed_in_percentage": "48.78%",
"wikis_checksummed_count": 10,
"wikis_checksum_failed_count": 3,
"wikis_checksummed_in_percentage": "24.39%",
"repositories_verified_count": 20,
"repositories_verification_failed_count": 5,
"repositories_verified_in_percentage": "48.78%",
"repositories_checksum_mismatch_count": 3,
"wikis_verified_count": 10,
"wikis_verification_failed_count": 3,
"wikis_verified_in_percentage": "24.39%",
"wikis_checksum_mismatch_count": 1,
"repositories_retrying_verification_count": 1,
"wikis_retrying_verification_count": 3,
"repositories_checked_count": 7,
"repositories_checked_failed_count": 2,
"repositories_checked_in_percentage": "17.07%",
"last_event_id": 23,
"last_event_timestamp": 1509681166,
"cursor_last_event_id": nil,
"cursor_last_event_timestamp": 0,
"last_successful_status_check_timestamp": 1510125024,
"version": "10.3.0",
"revision": "33d33a096a",
"package_files_count": 10,
"package_files_checksummed_count": 10,
"package_files_checksum_failed_count": 0,
"package_files_registry_count": 10,
"package_files_synced_count": 6,
"package_files_failed_count": 3
},
{
"geo_node_id": 2,
"healthy": true,
"health": "Healthy",
"health_status": "Healthy",
"missing_oauth_application": false,
"attachments_count": 1,
"attachments_synced_count": 1,
"attachments_failed_count": 0,
"attachments_synced_missing_on_primary_count": 0,
"attachments_synced_in_percentage": "100.00%",
"db_replication_lag_seconds": 0,
"lfs_objects_count": 0,
"lfs_objects_synced_count": 0,
"lfs_objects_failed_count": 0,
"lfs_objects_synced_missing_on_primary_count": 0,
"lfs_objects_synced_in_percentage": "0.00%",
"job_artifacts_count": 2,
"job_artifacts_synced_count": 1,
"job_artifacts_failed_count": 1,
"job_artifacts_synced_missing_on_primary_count": 0,
"job_artifacts_synced_in_percentage": "50.00%",
"container_repositories_count": 3,
"container_repositories_synced_count": nil,
"container_repositories_failed_count": nil,
"container_repositories_synced_in_percentage": "0.00%",
"design_repositories_count": 3,
"design_repositories_synced_count": nil,
"design_repositories_failed_count": nil,
"design_repositories_synced_in_percentage": "0.00%",
"projects_count": 41,
"repositories_failed_count": 1,
"repositories_synced_count": 40,
"repositories_synced_in_percentage": "97.56%",
"wikis_failed_count": 0,
"wikis_synced_count": 41,
"wikis_synced_in_percentage": "100.00%",
"replication_slots_count": nil,
"replication_slots_used_count": nil,
"replication_slots_used_in_percentage": "0.00%",
"replication_slots_max_retained_wal_bytes": nil,
"repositories_checksummed_count": 20,
"repositories_checksum_failed_count": 5,
"repositories_checksummed_in_percentage": "48.78%",
"wikis_checksummed_count": 10,
"wikis_checksum_failed_count": 3,
"wikis_checksummed_in_percentage": "24.39%",
"repositories_verified_count": 20,
"repositories_verification_failed_count": 5,
"repositories_verified_in_percentage": "48.78%",
"repositories_checksum_mismatch_count": 3,
"wikis_verified_count": 10,
"wikis_verification_failed_count": 3,
"wikis_verified_in_percentage": "24.39%",
"wikis_checksum_mismatch_count": 1,
"repositories_retrying_verification_count": 4,
"wikis_retrying_verification_count": 2,
"repositories_checked_count": 5,
"repositories_checked_failed_count": 1,
"repositories_checked_in_percentage": "12.20%",
"last_event_id": 23,
"last_event_timestamp": 1509681166,
"cursor_last_event_id": 23,
"cursor_last_event_timestamp": 1509681166,
"last_successful_status_check_timestamp": 1510125024,
"version": "10.3.0",
"revision": "33d33a096a",
"package_files_count": 10,
"package_files_checksummed_count": 10,
"package_files_checksum_failed_count": 0,
"package_files_registry_count": 10,
"package_files_synced_count": 6,
"package_files_failed_count": 3
}
]
Note:GitLab 12.0では、非推奨フィールド
wikis_count
とrepositories_count
が削除されました。代わりにprojects_count
を使用してください。特定の Geo ノードに関するステータスの取得
GET /geo_nodes/:id/status
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_nodes/2/status"
回答例
{
"geo_node_id": 2,
"healthy": true,
"health": "Healthy",
"health_status": "Healthy",
"missing_oauth_application": false,
"attachments_count": 1,
"attachments_synced_count": 1,
"attachments_failed_count": 0,
"attachments_synced_missing_on_primary_count": 0,
"attachments_synced_in_percentage": "100.00%",
"db_replication_lag_seconds": 0,
"lfs_objects_count": 0,
"lfs_objects_synced_count": 0,
"lfs_objects_failed_count": 0,
"lfs_objects_synced_missing_on_primary_count": 0,
"lfs_objects_synced_in_percentage": "0.00%",
"job_artifacts_count": 2,
"job_artifacts_synced_count": 1,
"job_artifacts_failed_count": 1,
"job_artifacts_synced_missing_on_primary_count": 0,
"job_artifacts_synced_in_percentage": "50.00%",
"container_repositories_count": 3,
"container_repositories_synced_count": nil,
"container_repositories_failed_count": nil,
"container_repositories_synced_in_percentage": "0.00%",
"design_repositories_count": 3,
"design_repositories_synced_count": nil,
"design_repositories_failed_count": nil,
"design_repositories_synced_in_percentage": "0.00%",
"projects_count": 41,
"repositories_failed_count": 1,
"repositories_synced_count": 40,
"repositories_synced_in_percentage": "97.56%",
"wikis_failed_count": 0,
"wikis_synced_count": 41,
"wikis_synced_in_percentage": "100.00%",
"replication_slots_count": nil,
"replication_slots_used_count": nil,
"replication_slots_used_in_percentage": "0.00%",
"replication_slots_max_retained_wal_bytes": nil,
"last_event_id": 23,
"last_event_timestamp": 1509681166,
"cursor_last_event_id": 23,
"cursor_last_event_timestamp": 1509681166,
"last_successful_status_check_timestamp": 1510125268,
"version": "10.3.0",
"revision": "33d33a096a"
}
注:health_status
パラメーターは “Healthy “または “Unhealthy “状態のみ、health
パラメーターは空、”Healthy”、または実際のエラーメッセージを含むことができます。
Note:GitLab 12.0では、非推奨フィールド
wikis_count
とrepositories_count
が削除されました。代わりにprojects_count
を使用してください。現在のノードで発生したプロジェクトの同期または検証の失敗を取得します。
これはセカンダリ・ノードでのみ機能します。
GET /geo_nodes/current/failures
属性 | タイプ | 必須 | 説明 |
---|---|---|---|
type
| 列 | いいえ | 失敗したオブジェクトのタイプ (repository /wiki )
|
failure_type
| 列 | いいえ | 故障の種類 (sync /checksum_mismatch /verification )
|
このエンドポイントはページネーションを使用します。
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://primary.example.com/api/v4/geo_nodes/current/failures"
回答例
[
{
"project_id": 3,
"last_repository_synced_at": "2017-10-31 14:25:55 UTC",
"last_repository_successful_sync_at": "2017-10-31 14:26:04 UTC",
"last_wiki_synced_at": "2017-10-31 14:26:04 UTC",
"last_wiki_successful_sync_at": "2017-10-31 14:26:11 UTC",
"repository_retry_count": null,
"wiki_retry_count": 1,
"last_repository_sync_failure": null,
"last_wiki_sync_failure": "Error syncing Wiki repository",
"last_repository_verification_failure": "",
"last_wiki_verification_failure": "",
"repository_verification_checksum_sha": "da39a3ee5e6b4b0d32e5bfef9a601890afd80709",
"wiki_verification_checksum_sha": "da39a3ee5e6b4b0d3255bfef9ef0189aafd80709",
"repository_checksum_mismatch": false,
"wiki_checksum_mismatch": false
}
]