CloudDB for MongoDB 서비스 연동
- 인쇄
- PDF
CloudDB for MongoDB 서비스 연동
- 인쇄
- PDF
Article Summary
Share feedback
Thanks for sharing your feedback!
VPC 환경에서 이용 가능합니다.
CloudDB for MongoDB 서비스 생성 예제
DB 버전별 상품 코드 목록
DB 버전 | 상품 코드 |
---|---|
MongoDB 4.2.12 Community Edition | SW.VMGDB.LNX64.CNTOS.0708.MNGDB.4212.CE.B050 |
MongoDB 4.2.23 Community Edition | SW.VMGDB.LNX64.CNTOS.0708.MNGDB.4223.CE.B050 |
MongoDB 4.4.18 Community Edition | SW.VMGDB.LNX64.CNTOS.0708.MNGDB.4418.CE.B050 |
MongoDB 4.2.12 Enterprise Edition | SW.VMGDB.LNX64.CNTOS.0708.MNGDB.4212.EE.B050 |
MongoDB 4.2.23 Enterprise Edition | SW.VMGDB.LNX64.CNTOS.0708.MNGDB.4223.EE.B050 |
MongoDB 4.4.18 Enterprise Edition | SW.VMGDB.LNX64.CNTOS.0708.MNGDB.4418.EE.B050 |
참고
DB 버전은 기본값으로 생성되고 있으며, 원하시는 DB 버전이 있으시면 생성 시 cloudMongoDbImageProductCode
파라미터에 생성할 DB 엔진 버전에 해당하는 상품 코드를 입력해 주십시오.
서비스 생성
cf create-service 서비스 플랜 {서비스명} -c 설정
명령으로 마켓플레이스의 서비스를 생성해 주십시오.
cf create-service cdbmongodb Sharding mongodb-sample -c '{
"shardCount":2,
"memberServerCount":2,
"arbiterServerCount":1,
"cloudMongoDbUserName":"****",
"cloudMongoDbUserPassword":"****",
"cloudMongoDbServiceName":"mongodb-sample",
"cloudMongoDbServerNamePrefix":"mongodb-prefix"
}'
Creating service instance mongodb-sample in org system / space system-space as admin...
Create in progress. Use 'cf services' or 'cf service mongodb-sample' to check operation status.
OK
참고
- Input Parameter를 json파일로 저장하여
cf create-service cdbmongodb Sharding mongodb-sample -c mongodb.json
도 가능합니다. - 입력할 수 있는 변수는 여기 를 클릭해 확인할 수 있습니다.
(파스타에 이미 설정된 regionCode, vpcNo, subnetNo, clusterTypeCode, responseFormatType 은 입력할 수 없습니다.) - 예제 파라미터에서 사용자명과 비밀번호는 마스킹 처리돼있으므로, 위 입력 가능한 변수를 참고해 올바른 값을 넣어주십시오.
주의
서비스 생성에 실패했을 경우, failed
메시지가 발생하며 서비스가 정상적으로 동작하지 않습니다.
서비스 삭제 후, 재생성 해주십시오.
서비스 상태 확인
cf service 서비스명
명령으로 서비스 상태를 확인해 주십시오.
- status에 서비스 상태(create in progress)가 표시됩니다.
cf service mongodb-sample
Showing info of service mongodb-sample in org system / space system-space as admin...
name: mongodb-sample
guid: 45b5b71d-12d3-417d-81f1-46aa99b24bbe
type: managed
broker: ncp-service-broker
offering: cdbmongodb
plan: Sharding
tags:
offering tags: cdb, mongodb
description: A MongoDB service, managed by NaverCloudPlatform.
documentation: https://guide-gov.ncloud-docs.com/release-20240222/docs/clouddbformongodb-overview
dashboard url:
Showing status of last operation:
status: create succeeded
message:
started: 2022-08-30T07:45:48Z
updated: 2022-08-30T07:45:48Z
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 MongoDB 인스턴스 생성이 완료되면 서비스 상태가 생성성공(create succeeded)으로 변경됩니다.
cf service mongodb-sample
Showing info of service mongodb-sample in org system / space system-space as admin...
name: mongodb-sample
guid: 45b5b71d-12d3-417d-81f1-46aa99b24bbe
type: managed
broker: ncp-service-broker
offering: cdbmongodb
plan: Sharding
tags:
offering tags: cdb, mongodb
description: A MongoDB service, managed by NaverCloudPlatform.
documentation: https://guide-gov.ncloud-docs.com/release-20240222/docs/clouddbformongodb-overview
dashboard url:
Showing status of last operation:
status: create succeeded
message:
started: 2022-08-30T07:45:48Z
updated: 2022-08-30T07:45:48Z
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 애플리케이션 서비스명
명령으로 애플리케이션에 cdbmongodb 서비스를 바인드해 주십시오.
참고
이 명령어를 사용하려면 파스타 애플리케이션이 배포되어 있어야 합니다.
예제에서 사용된 test-node-app은 여기를 클릭해 확인할 수 있습니다.
$ cf bind-service test-node-app mongodb-sample
Binding service instance mongodb-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에 cdbmongodb 서비스가 추가된 것을 확인 할 수 있습니다.
$ cf env test-node-app
Getting env variables for app test-node-app in org system / space system-space as admin...
System-Provided:
VCAP_SERVICES: {
"cdbmongodb": [
{
"binding_guid": "5a074061-9e97-4f96-b4a6-dbad3cb28a39",
"binding_name": null,
"credentials": {
"arbiterHosts": "test.example.naverncp.com:17017,test.example.naverncp.com:17017",
"authority": "READ_WRITE",
"configHosts": "test.example.naverncp.com:17017,test.example.naverncp.com:17017,test.example.naverncp.com:17017",
"databaseName": "db_167566309039",
"memberHosts": "test.example.naverncp.com:17017,test.example.naverncp.com:17017,test.example.naverncp.com:17017,test.example.naverncp.com:17017",
"mongosHosts": "test.example.naverncp.com:17017,test.example.naverncp.com:17017",
"password": "****",
"uri": "mongodb://****:****@test.example.naverncp.com:17017,test.example.naverncp.com:17017/db_167566309039",
"username": "****"
},
"instance_guid": "6e6c3d82-09fb-4f60-914d-ca068e637f0c",
"instance_name": "mongodb-shard",
"label": "cdbmongodb",
"name": "mongodb-shard",
"plan": "Sharding",
"provider": null,
"syslog_drain_url": null,
"tags": [
"cdb",
"mongodb"
],
"volume_mounts": []
}
]
}
VCAP_APPLICATION: {
"application_id": "84de9642-3199-4e56-81b1-7e43c2a15f93",
"application_name": "test-node-app",
"application_uris": [
"test-node-app.apps.test.example"
],
"cf_api": "https://api.test.example",
"limits": {
"fds": 16384
},
"name": "test-node-app",
"organization_id": "0f724497-b8f7-426c-bc48-5e926ae3a40c",
"organization_name": "system",
"space_id": "41dcd6b0-4c7d-4081-81a7-99f7d71708a5",
"space_name": "system-space",
"uris": [
"test-node-app.apps.test.example"
],
"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 test-node-app in org system / space system-space as admin...
서비스 Unbind
cf unbind-service 애플리케이션 서비스명
명령으로 애플리케이션에 cdbredis 서비스를 언바인드해 주십시오.
$ cf unbind-service test-node-app mongodb-sample
Unbinding app test-node-app from service redis-sample in org system / space system-space as admin...
OK
서비스 삭제
cf delete-service 서비스명
명령으로 서비스를 삭제해 주십시오.
cf delete-service mongodb-sample -f
Deleting service instance mongodb-sample in org system / space system-space as admin...
Delete in progress. Use 'cf services' or 'cf service mongodb-sample' to check operation status.
OK
이 문서가 도움이 되었습니까?