In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Original articles, welcome to reprint. Reprint please indicate: reproduced from IT Story Association, thank you!
Original link address: "Advanced articles" Service Newsletter under docker's microservice docker (19)
Last time we docked each service and made sure that every docker container was running, but we didn't let them communicate with each other, so this time we finished communicating with each other. Get the docker service up and running and ensure normal communication between them. Source code: https://github.com/limingios/msA-docker
Speaking of getting docker to communicate with each other.
Of the following three scenarios, which one is the best if you use redis,zookeeper,mysql? In this case, the microservice we developed uses the third solution. Use the second option for redis,zookeeper,mysql.
Direct communication, container IP and port direct access to the service. This approach works rarely because docker's ip is unstable and can change every time it is redone. The service maps the port out, maps the port of the service to the port of the host, and relies on its container to access the host's ip and port. Through the way of link, link to the host, directly through the name of the host to access. The way you use docker compose
We can also link one by one, but compose is a common use and the best solution, it can describe the relationship between services, very clear.
Version: '3'services: message-thrift-python-service: image: message-thrift-python-service:latest user-thrift-service: image: user-thrift-service:latest command:-"- mysql.address=192.168.1.130" user-edge-service: image: user-edge-service:latest links:-user-thrift-service-message-thrift-python-service command:-"-- Redis.address=192.168.1.130 "course-dubbo-service: image: course-dubbo-service:latest links:-user-thrift-service command:"-- mysql.address=192.168.1.130 "-"-- zookeeper.address=192.168.1.130 "course-edge-service: image: course-edge-service:latest links:-user-edge-service command: -"-- Zookeeper.address=192.168.1.130 "gataway-zuul: image: gataway-zuul:latest links:-user-edge-service-course-edge-service ports:-808080
It took about 2 days to configure this, which is too troublesome. It's too hard for a person to give up if he / she does micro-service. But the benefits of microservices are really obvious.
After each microservice is modified, calls between build.sh services are made, and all of them are configured in docker-compose by dockerlink. View the log of the micro-service and view the id of the micro-service through the docker logs container name docker ps
PS: three steps. The dockerization of the service is almost complete. The next step is to create the docker repository.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.