CloudDB for Redis 서비스 연동
    • PDF

    CloudDB for Redis 서비스 연동

    • PDF

    Article Summary

    VPC 환경에서 이용 가능합니다.

    CloudDB for Redis 서비스 생성 예제

    DB 엔진 버전별 상품 코드 목록

    DB 엔진 버전상품 코드
    Redis (6.2.4)SW.VDBAS.VRDS.LNX64.CNTOS.0708.REDIS.624.B050
    Redis (6.2.11)SW.VDBAS.VRDS.LNX64.CNTOS.0708.REDIS.6211.B050
    Redis (7.0.13)SW.VDBAS.VRDS.LNX64.CNTOS.0708.REDIS.7013.B050

    서비스 생성

    cf create-service 서비스 플랜 {서비스명} -c 설정 명령으로 마켓플레이스의 서비스를 생성해 주십시오.

    참고

    ConfigGroupNo를 입력하지 않으면 서비스 브로커가 ConfigGroup을 직접 생성합니다.
    ConfigGroup의 생성이 지연되어 타임아웃 에러가 발생할 경우 잠시 후 다시 시도해 주십시오.

    $ cf create-service cdbredis Simple-HA redis-sample -c '{
          "cloudRedisUserName": "****",
          "cloudRedisUserPassword": "****",
          "cloudRedisServiceName": "redis-sample",
          "cloudRedisServerNamePrefix":"nsb",
          "cloudRedisImageProductCode": "SW.VDBAS.VRDS.LNX64.CNTOS.0708.REDIS.624.B050"
      }'
      Creating service instance redis-sample in org system / space system as admin...
      OK
      
      Create in progress. Use 'cf services' or 'cf service redis-sample' to check operation status.
    
    참고
    • Input Parameter를 json파일로 저장하여 cf create-service cdbredis Simple-HA redis-sample -c redis.json도 가능합니다.
    • 입력할 수 있는 변수는 여기 를 클릭해 확인할 수 있습니다.
      (PaaS-TA에 이미 설정된 regionCode, vpcNo, isHa, subnetNo, cloudRedisModeCode, responseFormatType 은 입력할 수 없습니다.)
    • 예제 파라미터에서 사용자명과 비밀번호는 마스킹 처리돼있으므로, 위 입력 가능한 변수를 참고해 올바른 값을 넣어주십시오.
    주의

    서비스 생성에 실패했을 경우, failed 메시지가 발생하며 서비스가 정상적으로 동작하지 않습니다.
    서비스 삭제 후, 재생성 해주십시오.

    서비스 상태 확인

    cf service 서비스명 명령으로 서비스 상태를 확인해 주십시오.

    • status에 서비스 상태(create in progress)가 표시됩니다.
    $ cf service redis-sample
      Showing info of service redis-sample in org system / space system-space as admin...
      
      name:            redis-sample
      guid:            acb97cc0-83c8-4f8b-be82-5bc81c1489c8
      type:            managed
      broker:          ncp-service-broker
      offering:        cdbredis
      plan:            Simple-HA
      tags:
      offering tags:   cdb, redis
      description:     A Redis service, managed by NaverCloudPlatform.
      documentation:   https://guide-gov.ncloud-docs.com/release-20240222/docs/clouddbforredis-overview
      dashboard url:
      
      Showing status of last operation:
         status:    create in progress
         message:
         started:   2022-06-03T06:22:26Z
         updated:   2022-06-03T06:22:26Z
      
      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 Redis 인스턴스 생성이 완료되면 서비스 상태가 생성 성공(create succeeded) 으로 변경됩니다.

    $ cf service redis-sample
    cf service redis-sample
      Showing info of service redis-sample in org system / space system-space as 04855b30-da41-11eb-ab9a-0050568d0f16...
      
      name:            redis-sample
      guid:            acb97cc0-83c8-4f8b-be82-5bc81c1489c8
      type:            managed
      broker:          ncp-service-broker
      offering:        cdbredis
      plan:            Simple-HA
      tags:
      offering tags:   cdb, redis
      description:     A Redis service, managed by NaverCloudPlatform.
      documentation:   https://guide-gov.ncloud-docs.com/release-20240222/docs/clouddbforredis-overview
      dashboard url:
      
      Showing status of last operation:
         status:    create succeeded
         message:
         started:   2022-06-03T06:28:33Z
         updated:   2022-06-03T06:28:33Z
      
      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

    1. cf bind-service 애플리케이션 서비스명 명령으로 애플리케이션에 cdbredis 서비스를 바인드해 주십시오.
    참고

    이 명령어를 사용하려면 파스타 애플리케이션이 배포되어 있어야 합니다.
    예제에서 사용된 test-node-app은 여기를 클릭해 확인할 수 있습니다.

    $ cf bind-service test-node-app redis-sample
      Binding service instance redis-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
    
    1. cf env 애플리케이션 명령을 실행하여 VCAP_SERVICES에 cdbredis 서비스가 추가된 것을 확인 할 수 있습니다.
    $ 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: {
        "cdbredis": [
          {
            "binding_guid": "b999f92c-d8a3-4856-a805-a1f405af2f65",
            "binding_name": null,
            "credentials": {
              "hostname": "redis-server-kr.vpc-cdb.gov-ntruss.com",
              "password": "****",
              "port": 6379,
              "uri": "redis://****:****@redis-server-kr.vpc-cdb.gov-ntruss.com:6379",
              "username": "****"
            },
            "instance_guid": "acb97cc0-83c8-4f8b-be82-5bc81c1489c8",
            "instance_name": "redis-sample",
            "label": "cdbredis", 
            "name": "redis-sample",
            "plan": "Simple-HA",
            "provider": null,
            "syslog_drain_url": null,
            "tags": [
              "cdb",
              "redis"
            ],
            "volume_mounts": []
          }
        ]
      }
      
      
      VCAP_APPLICATION: {
        "application_id": "d56a0c32-3347-4b36-ac07-21e945456fbd",
        "application_name": "test-node-app",
        "application_uris": [
          "test-node-app.apps.test.domain"
        ],
        "cf_api": "https://api.test.domain",
        "limits": {
          "fds": 16384
        },
        "name": "test-node-app",
        "organization_id": "system-org-id",
        "organization_name": "system",
        "space_id": "system-space-id",
        "space_name": "system-space",
        "uris": [
          "test-node-app.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  
    
    1. 애플리케이션의 환경변수를 변경해 주십시오.
    $ 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 에러가 발생할 수 있습니다.

    1. 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 redis-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 redis-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 redis-sample? [yN]: y
      Deleting service instance redis-sample in org system / space system-space as admin...
      
      Delete in progress. Use 'cf services' or 'cf service redis-sample' to check operation status.
      OK
    

    이 문서가 도움이 되었습니까?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.