CloudDB for MySQL 서비스 연동
- 인쇄
- PDF
CloudDB for MySQL 서비스 연동
- 인쇄
- PDF
Article Summary
Share feedback
Thanks for sharing your feedback!
VPC 환경에서 이용 가능합니다.
CloudDB for MySQL 서비스 생성 예제
DB 엔진 버전별 상품 코드 목록
DB 엔진 버전 | 상품 코드 |
---|---|
mysql (5.7.29) | SW.VDBAS.DBAAS.LNX64.CNTOS.0708.MYSQL.5729.B050 |
mysql (5.7.32) | SW.VDBAS.DBAAS.LNX64.CNTOS.0708.MYSQL.5732.B050 |
mysql (5.7.37) | SW.VDBAS.DBAAS.LNX64.CNTOS.0708.MYSQL.5737.B050 |
mysql (5.7.40) | SW.VDBAS.DBAAS.LNX64.CNTOS.0708.MYSQL.5740.B050 |
mysql (8.0.18) | SW.VDBAS.DBAAS.LNX64.CNTOS.0708.MYSQL.8018.B050 |
mysql (8.0.21) | SW.VDBAS.DBAAS.LNX64.CNTOS.0708.MYSQL.8021.B050 |
mysql (8.0.25) | SW.VDBAS.DBAAS.LNX64.CNTOS.0708.MYSQL.8025.B050 |
mysql (8.0.32) | SW.VDBAS.DBAAS.LNX64.CNTOS.0708.MYSQL.8032.B050 |
mysql (8.0.34) | SW.VDBAS.DBAAS.LNX64.CNTOS.0708.MYSQL.8034.B050 |
참고
DB 버전은 기본값으로 생성되고 있으며, 원하시는 DB 버전이 있으시면 생성 시 cloudMysqlImageProductCode
파라미터에 생성할 DB 엔진 버전에 해당하는 상품 코드를 입력해 주십시오.
서비스 생성
cf create-service 서비스 플랜 {서비스명} -c 설정
명령으로 마켓플레이스의 서비스를 생성해 주십시오.
$ cf create-service cdbmysql HA mysql-sample -c '{
"cloudMysqlServiceName": "cdb-mysql",
"cloudMysqlServerNamePrefix": "cdb-mysql",
"cloudMysqlUserName": "****",
"cloudMysqlUserPassword":"****",
"hostIp":"%",
"cloudMysqlDatabaseName":"cdb_dbname"
}'
Creating service instance mysql-sample in org system / space system as admin...
OK
Create in progress. Use 'cf services' or 'cf service mysql-sample' to check operation status.
참고
- Input Parameter를 json파일로 저장하여
cf create-service cdbmysql HA mysql-sample -c mysql.json
도 가능합니다. - 입력 가능한 변수는 여기 를 클릭해 확인할 수 있습니다.
(파스타에 이미 설정된 regionCode, vpcNo, isHa, subnetNo, responseFormatType은 입력할 수 없습니다.) - 예제 파라미터에서 사용자명과 비밀번호는 마스킹 처리돼있으므로, 위 입력 가능한 변수를 참고해 올바른 값을 넣어주십시오.
주의
서비스 생성에 실패했을 경우, failed
메시지가 발생하며 서비스가 정상적으로 동작하지 않습니다.
서비스 삭제 후, 재생성 해주십시오.
서비스 상태 확인
cf service 서비스명
명령으로 서비스 상태를 확인해 주십시오.
- status에 서비스 상태(create in progress)가 표시됩니다.
$ cf service mysql-sample
Showing info of service mysql-sample in org system / space system-space as admin...
name: mysql-sample
guid: 7a3259ba-f737-45d9-9c96-872f5e25bc3e
type: managed
broker: ncp-service-broker
offering: cdbmysql
plan: HA
tags:
offering tags: cdb, mysql
description: A Mysql service, managed by NaverCloudPlatform.
documentation: https://guide-gov.ncloud-docs.com/release-20240222/docs/database-database-5-6
dashboard url:
Showing status of last operation:
status: create in progress
message:
started: 2022-06-02T21:22:09Z
updated: 2022-06-02T21:22:09Z
Showing bound apps:
There are no bound apps for this service instance.
Showing sharing info:
This service instance is not currently being shared.
The "service_instance_sharing" feature flag is disabled for this Cloud Foundry platform.
Service instance sharing is disabled for this service offering.
Showing upgrade status:
Upgrades are not supported by this broker.
- CloudDB for MySQL 인스턴스 생성이 완료되면 서비스 상태가 생성 성공(create succeeded) 으로 변경됩니다.
$ cf service mysql-sample
Showing info of service mysql-sample in org system / space system-space as admin...
name: mysql-sample
guid: 7a3259ba-f737-45d9-9c96-872f5e25bc3e
type: managed
broker: ncp-service-broker
offering: cdbmysql
plan: HA
tags:
offering tags: cdb, mysql
description: A Mysql service, managed by NaverCloudPlatform.
documentation: https://guide-gov.ncloud-docs.com/release-20240222/docs/database-database-5-6
dashboard url:
Showing status of last operation:
status: create succeeded
message:
started: 2022-06-02T21:28:20Z
updated: 2022-06-02T21:28:20Z
Showing bound apps:
There are no bound apps for this service instance.
Showing sharing info:
This service instance is not currently being shared.
The "service_instance_sharing" feature flag is disabled for this Cloud Foundry platform.
Service instance sharing is disabled for this service offering.
Showing upgrade status:
Upgrades are not supported by this broker.
서비스 Bind
cf bind-service 애플리케이션 서비스명
명령으로 애플리케이션에 cdbmysql 서비스를 바인드해 주십시오.
참고
이 명령어를 사용하려면 파스타 애플리케이션이 배포되어 있어야 합니다.
예제에서 사용된 test-node-app은 여기를 클릭해 확인할 수 있습니다.
$ cf bind-service test-node-app mysql-sample
Binding service instance mysql-sample to app test-node-app in org system / space system-space as admin...
OK
TIP: Use 'cf restage test-node-app' to ensure your env variable changes take effect
cf env 애플리케이션
명령을 실행하여 VCAP_SERVICES에 cdbmysql 서비스가 추가된 것을 확인 할 수 있습니다.
$ cf env test-node-app
Getting env variables for app nginx-sample in org system / space system-space as admin...
System-Provided:
VCAP_SERVICES: {
"cdbmysql": [
{
"binding_guid": "d9cb040d-0687-4502-ba57-31bcc9236a43",
"binding_name": null,
"credentials": {
"hostname": "mysql-host.vpc-cdb.gov-ntruss.com",
"jdbcUrl": "jdbc:mysql://mysql-host.vpc-cdb.gov-ntruss.com:3306/cdb_dbname?reconnect=true",
"password": "****",
"port": 3306,
"uri": "mysql://****:****@mysql-host.vpc-cdb.gov-ntruss.com:3306/cdb_dbname&useSSL=false",
"username": "****"
},
"instance_guid": "7a3259ba-f737-45d9-9c96-872f5e25bc3e",
"instance_name": "mysql-sample",
"label": "cdbmysql",
"name": "mysql-sample",
"plan": "HA",
"provider": null,
"syslog_drain_url": null,
"tags": [
"cdb",
"mysql"
],
"volume_mounts": []
}
]
}
VCAP_APPLICATION: {
"application_id": "5736031d-b355-4677-ad32-b6176a5f0c36",
"application_name": "test-node-app",
"application_uris": [
"nginx-sample.apps.test.domain"
],
"cf_api": "https://api.test.domain",
"limits": {
"fds": 16384
},
"name": "test-node-app",
"organization_id": "d466eba9-ac71-41f9-aba2-4c146368c170",
"organization_name": "system",
"space_id": "4e924560-9667-456d-a5ea-962b5ebae1c4",
"space_name": "system-space",
"uris": [
"nginx-sample.apps.test.domain"
],
"users": null
}
No user-provided env variables have been set
No running env variables have been set
No staging env variables have been set
- 애플리케이션의 환경변수를 변경해 주십시오.
$ cf set-env test-node-app BOUND_AT $(date +%s)
Setting env variable BOUND_AT for app test-node-app in org system / space system-space as admin...
OK
TIP: Use 'cf restage test-node-app' to ensure your env variable changes take effect.
주의
애플리케이션의 환경변수를 변경하지 않고 restage를 수행하면 StagingTimeExpired 에러가 발생할 수 있습니다.
cf restage 애플리케이션
명령으로 추가된 ENV로 애플리케이션을 다시 기동해 주십시오.
$ cf restage test-node-app
This action will cause app downtime.
Restaging app nginx-sample in org system / space system-space as admin...
...
서비스 Unbind
cf unbind-service 애플리케이션 서비스명
명령으로 애플리케이션에 cdbmysql 서비스를 언바인드해 주십시오.
$ cf unbind-service test-node-app mysql-sample
Unbinding app nginx-sample from service mysql-sample in org system / space system-space as admin...
OK
서비스 삭제
cf delete-service 서비스명
명령으로 서비스를 삭제해 주십시오.
$ cf delete-service mysql-sample
This action impacts all resources scoped to this service instance, including service bindings, service keys and route bindings.
This will remove the service instance from any spaces where it has been shared.
Really delete the service instance mysql-sample? [yN]: y
Deleting service instance mysql-sample in org system / space system-space as admin..
Service instance mysql-sample deleted.
OK
이 문서가 도움이 되었습니까?