클러스터 모드 사용
다음 API는 클러스터 모드를 사용으로 설정한 클러스터에 사용할 수 있습니다.
caution
user.password
필드의 값은 암호화한 값을 넣어야지만 정상적으로 생성이 가능합니다.
클러스터 생성
새로운 클러스터를 생성합니다. 생성 시, 최소 샤드 개수는 1개, 최대 샤드 개수는 12개입니다.
Request
클러스터 생성 Request Syntax
curl -X POST "https://redis.kr-central-2.kakaocloud.com/v1/clusters" \
-H "X-Auth-Token: {token-id}" \
-H "Content-Type: application/json" \
-d '{Body}'
종류 | 파라미터 | 유형 | 설명 |
---|---|---|---|
Header | {token-id} * | String | API 인증 토큰 참고 |
Content-Type* | String | 콘텐츠 타입 기본값: application/json | |
Body | name* | String | 클러스터 이름 |
description | String | 클러스터 설명 | |
version* | String | Redis 버전 | |
port* | Integer | Redis 포트 번호 | |
shardCount* | Integer | 샤드 수 | |
nodeCountPerShard* | Integer | 샤드 당 노드 수 | |
flavorId* | String | 플레이버 ID | |
subnets[]* | Object Array | 배치 가능한 서브넷 목록 | |
subnets[].id* | String | 서브넷 ID - 서브넷 ID는 콘솔 > VPC > 서브넷에서 확인 | |
subnetAssignments[]* | Object Array | 서브넷 배치 목록 | |
subnetAssignments[].primary* | Object | Primary에 배치할 서브넷 | |
subnetAssignments[].primary.id* | String | Primary에 배치할 서브넷 ID | |
subnetAssignments[].replicas[]* | Object Array | Replica에 배치할 서브넷 목록 | |
subnetAssignments[].replicas[].id* | String | Replica에 배치할 서브넷 ID | |
securityGroups[]* | Object Array | 클러스터에 연결할 보안 그룹 목록 | |
securityGroups[].id* | String | 클러스터에 연결할 보안 그룹 ID - 보안 그룹 ID는 콘솔 > VPC > 보안 그룹에서 확인 가능 | |
user.name | String | 데이터베이스 사용자 이름 | |
user.password | String | 데이터베이스 사용자 암호 (암호화된 형태 또는 암호 해시) 데이터베이스 사용자 암호 암호화 방법 |
클러스터 생성 Request Body Example
{
"name": "test-cluster",
"description": "test-cluster",
"version": "6.2.5",
"port": 6379,
"shardCount": 2,
"nodeCountPerShard": 3,
"flavorId": "3830ebad-ea2f-4822-8a7d-9e301c86a58d",
"subnets": [
{"id": "xxxxxxxx-0a69-4f8b-b56d-59ce12b4d55b"},
{"id": "yyyyyyyy-0a69-4f8b-b56d-59ce12b4d55b"}
],
"subnetAssignments": [
{
"primary": {"id": "xxxxxxxx-0a69-4f8b-b56d-59ce12b4d55b"},
"replicas": [
{"id": "yyyyyyyy-0a69-4f8b-b56d-59ce12b4d55b"},
{"id": "yyyyyyyy-0a69-4f8b-b56d-59ce12b4d55b"}
]
},
{
"primary": {"id": "xxxxxxxx-0a69-4f8b-b56d-59ce12b4d55b"},
"replicas": [
{"id": "yyyyyyyy-0a69-4f8b-b56d-59ce12b4d55b"},
{"id": "yyyyyyyy-0a69-4f8b-b56d-59ce12b4d55b"}
]
}
],
"securityGroups": [
{"id": "abcdxxxx-4870-4c4e-a267-2de13e38c2ea"},
{"id": "qwergggg-4870-4c4e-a267-2de13e38c2ea"}
]
}
Response
상태코드 | 설명 |
---|---|
201 | 리소스 생성 요청에 대한 성공 응답 |
400 | 사용자의 요청이 유효하지 않아 작업을 진행할 수 없음 |
401 | 인증되지 않은 사용자가 요청한 경우 |
403 | 권한이 없는 사용자가 요청한 경우 |
409 | 현재 서버의 상태에 중복된 요청이 발생한 경우 |
422 | 사용자의 요청 구문은 유효하지만 작업을 진행할 수 없는 경우 |
500 | 내부 에러로 작업을 진행할 수 없는 경우 |
필드 | 유형 | 설명 |
---|---|---|
objectId | String | 클러스터 ID |
클러스터 생성 Response Example
201 Created
content-length: 52
content-type: application/json; charset=UTF-8
{
"objectId": "qwerqwer-7347-4d87-a49f-e705e91db2fb"
}
클러스터 정보 수정
특정 클러스터의 일부 정보를 변경합니다.
Request
클러스터 정보 수정 Request Syntax
curl -X PATCH "https://redis.kr-central-2.kakaocloud.com/v1/clusters/{cluster-id}" \
-H "accept: application/json" \
-H "X-Auth-Token: {token-id}" \
-d '{Body}'
종류 | 파라미터 | 유형 | 설명 |
---|---|---|---|
URL | {cluster-id} * | String | 클러스터 ID |
Header | {token-id} * | String | API 인증 토큰 참고 |
Body | description* | String | 변경할 정보(클러스터 설명) |
클러스터 정보 수정 Request Body Example
{
"description": "modify description"
}
Response
상태코드 | 설명 |
---|---|
200 | 리소스 수정 요청에 대한 성공 응답 |
400 | 사용자의 요청이 유효하지 않아 작업을 진행할 수 없음 |
401 | 인증되지 않은 사용자가 요청한 경우 |
403 | 권한이 없는 사용자가 요청한 경우 |
404 | 사용자가 요청한 리소스가 존재하지 않은 경우 |
500 | 내부 에러로 작업을 진행할 수 없는 경우 |
필드 | 유형 | 설명 |
---|---|---|
objectId | String | 클러스터 ID |
클러스터 정보 수정 Response Example
200 OK
content-length: 52
content-type: application/json; charset=UTF-8
{
"objectId": "qwerqwer-7347-4d87-a49f-e705e91db2fb"
}
클러스터 삭제
특정 클러스터를 삭제합니다.
Request
클러스터 삭제 Request Syntax
curl -X DELETE "https://redis.kr-central-2.kakaocloud.com/v1/clusters/{cluster-id}" \
-H "X-Auth-Token: {token-id}"
종류 | 파라미터 | 유형 | 설명 |
---|---|---|---|
URL | {cluster-id} * | String | 클러스터 ID |
Header | {token-id} * | String | API 인증 토큰 참고 |
Response
상태코드 | 설명 |
---|---|
200 | 리소스 조회/삭제 요청에 대한 성공 응답 |
400 | 사용자의 요청이 유효하지 않아 작업을 진행할 수 없음 |
401 | 인증되지 않은 사용자가 요청한 경우 |
403 | 권한이 없는 사용자가 요청한 경우 |
404 | 사용자가 요청한 리소스가 존재하지 않은 경우 |
500 | 내부 에러로 작업을 진행할 수 없는 경우 |
필드 | 유형 | 설명 |
---|---|---|
objectId | String | 클러스터 ID |
클러스터 삭제 Response Example
200 OK
content-length: 52
content-type: application/json; charset=UTF-8
{
"objectId": "qwerqwer-7347-4d87-a49f-e705e91db2fb"
}
샤드 추가
특정 클러스터에 샤드를 추가합니다.
Request
샤드 추가 Request Syntax
curl -X POST "https://redis.kr-central-2.kakaocloud.com/v1/clusters/{cluster-id}/shards" \
-H "X-Auth-Token: {token-id}" \
-d '{Body}'
종류 | 파라미터 | 유형 | 설명 |
---|---|---|---|
URL | {cluster-id} * | String | 클러스터 ID |
Header | {token-id} | String | API 인증 토큰 참고 |
Body | nodeCount* | Integer | 샤드에 추가되는 노드 수 |
subnetAssignments[]* | Object | 서브넷 배치 목록 | |
subnetAssignments[].primary* | Object | Primary에 배치할 서브넷 | |
subnetAssignments[].primary.id* | String | Primary에 배치할 서브넷 ID | |
subnetAssignments[].replicas[]* | Array | Replica에 배치할 서브넷 목록 | |
subnetAssignments[].replicas[].id* | String | Replica에 배치할 서브넷 ID |
샤드 추가 Request Body Example
{
"nodeCount": 3,
"subnetAssignments": {
"primary": {"id": "xxxxxxxx-0a69-4f8b-b56d-59ce12b4d55b"},
"replicas": [
{"id": "yyyyyyyy-0a69-4f8b-b56d-59ce12b4d55b"},
{"id": "yyyyyyyy-0a69-4f8b-b56d-59ce12b4d55b"}
]
}
}
Response
상태코드 | 설명 |
---|---|
201 | 리소스 생성 요청에 대한 성공 응답 |
400 | 사용자의 요청이 유효하지 않아 작업을 진행할 수 없음 |
401 | 인증되지 않은 사용자가 요청한 경우 |
403 | 권한이 없는 사용자가 요청한 경우 |
404 | 사용자가 요청한 리소스가 존재하지 않은 경우 |
500 | 내부 에러로 작업을 진행할 수 없는 경우 |
필드 | 유형 | 설명 |
---|---|---|
objectId | String | 클러스터 ID |
샤드 추가 Response Example
201 Created
content-length: 52
content-type: application/json; charset=UTF-8
{
"objectId": "875bb16f-7347-4d87-a49f-e705e91db2fb"
}
클러스터의 샤드 목록 조회
특정 클러스터의 샤드 목록을 조회합니다.
Request
샤드 목록 조회 Request Syntax
curl -X GET "https://redis.kr-central-2.kakaocloud.com/v1/clusters/{cluster-id}/shards" \
-H "X-Auth-Token: {token-id}"
종류 | 파라 미터 | 유형 | 설명 |
---|---|---|---|
URL | {cluster-id} * | String | 클러스터 ID |
Header | {token-id} | String | API 인증 토큰 참고 |
Response
상태코드 | 설명 |
---|---|
200 | 리소스 조회/삭제 요청에 대한 성공 응답 |
400 | 사용자의 요청이 유효하지 않아 작업을 진행할 수 없음 |
401 | 인증되지 않은 사용자가 요청한 경우 |
403 | 권한이 없는 사용자가 요청한 경우 |
404 | 사용자가 요청한 리소스가 존재하지 않은 경우 |
500 | 내부 에러로 작업을 진행할 수 없는 경우 |
필드 | 유형 | 설명 |
---|---|---|
shards[] | Object Array | 샤드 목록 |
shards[].id | String | 샤드 ID |
shards[].name | String | 샤드 이름 |
shards[].slots | String | 할당된 슬롯 범위 |
shards[].nodes[] | Object Array | 노드 목록 |
shards[].nodes[].id | String | 노드 ID |
shards[].nodes[].name | String | 노드 이름 |
shards[].nodes[].subnet | Object | 노드에 배치된 서브넷 정보 |
shards[].nodes[].subnet.id | String | 노드에 배치된 서브넷 ID |
shards[].nodes[].endpoint | String | 노드 엔드포인트 (프라이빗 IP) |
shards[].nodes[].role | String | 노드 역할 (primary/replica) |
shards[].nodes[].status | String | 노드 상태 |
shards[].nodes[].createdAt | Integer | 노드 생성 시간 (RFC3339) |
shards[].status | String | 샤드 상태 |
shards[].createdAt | Integer | 샤드 생성 시간 (RFC3339) |
샤드 목록 조회 Response Example
200 OK
content-type: application/json; charset=UTF-8
{
"shards": [
{
"id": "001",
"name": "test-cluster-001",
"slots": "0-8191",
"nodes": [
{
"id": "aaaaaaaa-c12e-46f9-81a0-60ab1950a480",
"name": "test-cluster-001-001",
"subnet": {"id": "xxxxxxxx-0a69-4f8b-b56d-59ce12b4d55b"},
"endpoint": "10.184.x.x",
"role": "primary",
"status": "Modifying",
"createdAt": 1637915937
},
{
"id": "bbbbbbbb-c12e-46f9-81a0-60ab1950a480",
"name": "test-cluster-001-002",
"subnet": {"id": "yyyyyyyy-0a69-4f8b-b56d-59ce12b4d55b"},
"endpoint": "10.184.x.x",
"role": "replica",
"status": "Modifying",
"createdAt": 1637915937
},
{
"id": "cccccccc-c12e-46f9-81a0-60ab1950a480",
"name": "test-cluster-001-003",
"subnet": {"id": "yyyyyyyy-0a69-4f8b-b56d-59ce12b4d55b"},
"endpoint": "10.184.x.x",
"role": "replica",
"status": "Modifying",
"createdAt": 1637915937
}
],
"status": "Modifying",
"createdAt": 1637915937
},
{
"id": "002",
"name": "test-cluster-002",
"slots": "8192-16383",
"nodes": [
{
"id": "dddddddd-c12e-46f9-81a0-60ab1950a480",
"name": "test-cluster-002-001",
"subnet": {"id": "yyyyyyyy-0a69-4f8b-b56d-59ce12b4d55b"},
"endpoint": "10.184.x.x",
"role": "primary",
"status": "Modifying",
"createdAt": 1637915937
},
{
"id": "eeeeeeee-c12e-46f9-81a0-60ab1950a480",
"name": "test-cluster-002-002",
"subnet": {"id": "xxxxxxxx-0a69-4f8b-b56d-59ce12b4d55b"},
"endpoint": "10.184.x.x",
"role": "replica",
"status": "Modifying",
"createdAt": 1637915937
},
{
"id": "ffffffff-c12e-46f9-81a0-60ab1950a480",
"name": "test-cluster-002-003",
"subnet": {"id": "xxxxxxxx-0a69-4f8b-b56d-59ce12b4d55b"},
"endpoint": "10.184.x.x",
"role": "replica",
"status": "Modifying",
"createdAt": 1637915937
}
],
"status": "Modifying",
"createdAt": 1637915937
}
]
}
샤드 상세 정보 조회
특정 클러스터의 특정 샤드의 상세 정보를 조회합니다.
Request
샤드 상세 정보 조회 Request Syntax
curl -X GET "https://redis.kr-central-2.kakaocloud.com/v1/clusters/{cluster-id}/shards/{shard-id}" \
-H "X-Auth-Token: {token-id}"
종류 | 파라미터 | 유형 | 설명 |
---|---|---|---|
URL | {cluster-id} * | String | 클러스터 ID |
{shard-id} * | String | 샤드 ID | |
Header | {token-id} * | String | API 인증 토큰 참고 |
Response
상태코드 | 설명 |
---|---|
200 | 리소스 조회/삭제 요청에 대한 성공 응답 |
400 | 사용자의 요청이 유효하지 않아 작업을 진행할 수 없음 |
401 | 인증되지 않은 사용자가 요청한 경우 |
403 | 권한이 없는 사용자가 요청한 경우 |
404 | 사용자가 요청한 리소스가 존재하지 않은 경우 |
500 | 내부 에러로 작업을 진행할 수 없는 경우 |
필드 | 유형 | 설명 |
---|---|---|
id | String | 샤드 ID |
name | String | 샤드 이름 |
slots | String | 할당된 슬롯 범위 |
nodes[] | Object Array | 노드 목록 |
nodes[].id | String | 노드 ID |
nodes[].name | String | 노드 이름 |
nodes[].subnet | Object | 노드에 배치된 서브넷 정보 |
nodes[].subnet.id | String | 노드에 배치된 서브넷 ID |
nodes[].endpoint | String | 노드 엔드포인트 (프라이빗 IP) |
nodes[].role | String | 노드 역할 (primary/replica) |
nodes[].status | String | 노드 상태 |
nodes[].createdAt | Integer | 노드 생성 시간 (RFC3339) |
status | String | 샤드 상태 |
createdAt | Integer | 샤드 생성 시간 (RFC3339) |
샤드 상세 정보 조회 Response Example
200 OK
content-type: application/json; charset=UTF-8
{
"id": "001",
"name": "test-cluster-001",
"slots": "0-8191",
"nodes": [
{
"id": "aaaaaaaa-c12e-46f9-81a0-60ab1950a480",
"name": "test-cluster-001-001",
"subnet": {"id": "xxxxxxxx-0a69-4f8b-b56d-59ce12b4d55b"},
"endpoint": "10.184.x.x",
"role": "primary",
"status": "Modifying",
"createdAt": 2024-03-06T02:35:13Z
},
{
"id": "bbbbbbbb-c12e-46f9-81a0-60ab1950a480",
"name": "test-cluster-001-002",
"subnet": {"id": "yyyyyyyy-0a69-4f8b-b56d-59ce12b4d55b"},
"endpoint": "10.184.x.x",
"role": "replica",
"status": "Modifying",
"createdAt": 2024-03-06T02:35:13Z
},
{
"id": "cccccccc-c12e-46f9-81a0-60ab1950a480",
"name": "test-cluster-001-003",
"subnet": {"id": "yyyyyyyy-0a69-4f8b-b56d-59ce12b4d55b"},
"endpoint": "10.184.x.x",
"role": "replica",
"status": "Modifying",
"createdAt": 2024-03-06T02:35:13Z
}
],
"status": "Modifying",
"createdAt": 2024-03-06T02:35:13Z
}
샤드 삭제
특정 클러스터의 특정 샤드를 삭제합니다.
Request
샤드 삭제 Request Syntax
curl -X DELETE "https://redis.kr-central-2.kakaocloud.com/v1/clusters/{cluster-id}/shards/{shard-id}" \
-H "X-Auth-Token: {token-id}"
종류 | 파라미터 | 유형 | 설명 |
---|---|---|---|
URL | {cluster-id} * | String | 클러스터 ID |
{shard-id} * | String | 샤드 ID | |
Header | {token-id} * | String | API 인증 토큰 참고 |
Response
상태코드 | 설명 |
---|---|
200 | 리소스 조회/삭제 요청에 대한 성공 응답 |
400 | 사용자의 요청이 유효하지 않아 작업을 진행할 수 없음 |
401 | 인증되지 않은 사용자가 요청한 경우 |
403 | 권한이 없는 사용자가 요청한 경우 |
404 | 사용자가 요청한 리소스가 존재하지 않은 경우 |
500 | 내부 에러로 작업을 진행할 수 없는 경우 |
필드 | 유형 | 설명 |
---|---|---|
objectId | String | 클러스터 ID |
샤드 삭제 Response Example
200 OK
content-length: 52
content-type: application/json; charset=UTF-8
{
"objectId": "qwerqwer-7347-4d87-a49f-e705e91db2fb",
}
샤드에 Replica 추가
특정 클러스터의 특정 샤드에 Replica(복제본)를 추가합니다.
Request
샤드에 Replica 추가 Request Syntax
curl -X POST "https://redis.kr-central-2.kakaocloud.com/v1/clusters/{cluster-id}/shards/{shard-id}/nodes" \
-H "X-Auth-Token: {token-id}" \
-d '{Body}'
종류 | 파라미터 | 유형 | 설명 |
---|---|---|---|
URL | {cluster-id} * | String | 클러스터 ID |
{shard-id} * | String | 샤드 ID | |
Header | {token-id} * | String | API 인증 토큰 참고 |
Body | subnet* | Object | 서브넷 배치 정보 |
subnet.id* | String | 배치할 서브넷 ID |
샤드에 Replica 추가 Request Body Example
{
"subnet": {"id": "yyyyyyyy-0a69-4f8b-b56d-59ce12b4d55b"}
}
Response
상태코드 | 설명 |
---|---|
201 | 리소스 생성 요청에 대한 성공 응답 |
400 | 사용자의 요청이 유효하지 않아 작업을 진행할 수 없음 |
401 | 인증되지 않은 사용자가 요청한 경우 |
403 | 권한이 없는 사용자가 요청한 경우 |
404 | 사용자가 요청한 리소스가 존재하지 않은 경우 |
500 | 내부 에러로 작업을 진행할 수 없는 경우 |
필드 | 유형 | 설명 |
---|---|---|
objectId | String | 클러스터 ID |
샤드에 Replica 추가 Response Example
201 Created
content-length: 52
content-type: application/json; charset=UTF-8
{
"objectId": "qwerqwer-7347-4d87-a49f-e705e91db2fb"
}