cloudfoundry 配合service使用

cloudfoundry 命令

cf login -a url

为cluster创建一个实例service,
cf create-service kafka standard gtt-core-kafka-ref -c '{ "number_of_brokers": 3, "disk_per_broker": "1500G", "allowed_spark_clusters": [],"productive": true}'

创建一个类似广播或者是share的东西供其他使用,供其他的space使用
cf kafka create-advertisement cluster gtt-canary-advertisement

查看share的cluster的service ID
cf kafka marketplace|grep gtt-canary-advertisement
gtt-canary-advertisement                                b1e863cc-3cbd-449f-bf11-a75def6f6484            cluster         LBNPlatform                     true            Auto created cluster

切换target引用这个cluster
cf t -s acc 切换到指定的space
然后通过如下命令使用共享的service cluster
cf create-service kafka reference gtt-core-kafka-ref -c '{"advertisement": "b1e863cc-3cbd-449f-bf11-a75def6f6484"}'

cf kafka create-topic LBN.GTT.2602b70f-9591-11ea-a9df-bd55588ef805.IDoc --partitions 10 --replication-factor 3
需要查看有没有
#cf create-service-key gtt-core-kafka-ref gtt-kafka-key
cat bind.log | grep gtt-core-kafka-ref|sed 's\, \,\g'|awk '{print $4}'|sed 's/,/\n/g'|awk '{print "cf us " $1 " gtt-core-kafka-ref-old\n" "cf bs " $1 " gtt-core-kafka-ref\n" "cf restage " $1 " &"}'|sh


cf services |grep 'gtt-core-kafka-ref' >bind.log 将所有service相关的信息采集,包括名字等信息
cf renamne-service gtt-core-kafka-ref gtt-core-kafka-ref-old
cf rename-service gtt-core-kafka-dedicated cf-core-kafka-ref

cf target gtt-core-kafka-ref gtt-kafka-key
cf create-service kafka standard gtt-core-kafka-ref -c '{ "number_of_brokers": 3, "disk_per_broker": "1500G", "allowed_spark_clusters": [],"productive": true}'

cf us gtt-consumer-event-int-2_11_0-20210126081454+9b3b5cd62d878919ac9610c26af3-2021-01-26_08:17:37gtt-core-kafka-ref-old
cf bs gtt-consumer-event-int-2_11_0-20210126081454+9b3b5cd62d878919ac99610c26af3-2021-01-26_08:17:37 gtt-core-kafka-ref
cf restage gtt-consumer-event-int-2_11_0-20210126081454+9b3b5cd62d878919a0c26af3-2021-01-26_08:17:37 &


你可能感兴趣的:(cloudfoundry 配合service使用)