{% include toc %}
ServiceCenter is a service registry. The service provider can register its own instance information to the ServiceCenter for the service consumer to discover and use.
# Decompression the package $ tar -zxvf apache-servicecomb-service-center-1.3.0-linux-amd64.tar.gz # Start the service of servicecenter $ cd apache-servicecomb-service-center-1.3.0-linux-amd64/ $ ./start-service-center.sh
# View process status $ ps -ef | grep service-center root 27048 1 2 14:38 pts/2 00:00:00 ./service-center root 27164 22742 0 14:38 pts/2 00:00:00 grep --color=auto service-center # View the listening port $ netstat -apn | grep :30100 tcp 0 0 127.0.0.1:30100 0.0.0.0:* LISTEN 27048/service-cente # Call the interface with the curl command $ curl http://127.0.0.1:30100 {"_links":{"pb:latest-pact-versions":{"href":"http://127.0.0.1:30100/pacts/latest","title":"Latest pact versions"},"pb:latest-provider-pacts":{"href":"http://127.0.0.1:30100/pacts/provider/{provider}/latest","title":"Latest pacts by provider","templated":true},"pb:latest-provider-pacts-with-tag":{"href":"http://127.0.0.1:30100/pacts/provider/{provider}/latest/{tag}","title":"Latest pacts by provider with a specified tag","templated":true},"pb:pacticipants":{"href":"http://127.0.0.1:30100/participants","title":"Pacticipants"},"pb:publish-pact":{"href":"http://127.0.0.1:30100/pacts/provider/{provider}/consumer/{consumer}/version/{consumerApplicationVersion}","title":"Publish a pact","templated":true},"pb:webhooks":{"href":"http://127.0.0.1:30100/webhooks","title":"Webhooks"},"self":{"href":"http://127.0.0.1:30100/","title":"Index"}},"curies":[{"href":"http://127.0.0.1:30100/doc/{rel}","name":"pb"}]} # If the above content is returned, the startup was successful.
$ ./start-frontend.sh $ ps -ef | grep frontend root 1875 32096 0 17:43 pts/6 00:00:00 grep --color=auto frontend root 3020 1 0 Nov05 ? 00:00:23 ./frontend # View the listening port $ netstat -apn | grep :30103 tcp 0 0 127.0.0.1:30103 0.0.0.0:* LISTEN 3020/frontend
# Download the docker image $ docker pull servicecomb/service-center # Start docker container $ docker run -d -p 30100:30100 servicecomb/service-center
$ docker ps | grep service-center 0733021cd96d servicecomb/service-center "/opt/service-cent..." 3 minutes ago Up 3 minutes 0.0.0.0:30100->30100/tcp gallant_varahamihira
$ cat <<EOF >> ./service-center.yaml apiVersion: v1 kind: Service metadata: name: servicecenter namespace: svccomb-system labels: app: servicecenter spec: ports: - port: 30100 name: http selector: app: servicecenter --- apiVersion: extensions/v1beta1 kind: Deployment metadata: name: servicecenter namespace: svccomb-system spec: replicas: 1 template: metadata: labels: app: servicecenter version: v1 spec: containers: - name: servicecenter image: servicecomb/service-center:latest imagePullPolicy: IfNotPresent ports: - containerPort: 30100 EOF
# create namespace "svccomb-system" $ kubectl create namespace svccomb-system # deploy service-center $ kubectl apply -f service-center.yaml
# View Pod status $ kubectl -n svccomb-system get pod NAME READY STATUS RESTARTS AGE servicecenter-7d964b7644-h6f4s 1/1 Running 0 72s # View the the listening port of service $ kubectl -n svccomb-system get service NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE servicecenter ClusterIP 10.104.241.163 <none> 30100/TCP 118s $ curl http://10.104.241.163:30100 ...