In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Original articles, welcome to reprint. Reprint please indicate: reproduced from IT Story Association, thank you!
Original link address: "Advanced article" docker adjustment micro-service adapts to mesos (25)
Last time, the cluster environment of mesos was built. This time, let's take a look at how to run mesos on the cluster. The first problem to consider is the discovery of the service. How to do it on the same machine with docker-compose before? is it through the name of link? the premise of link is that it needs to be on the same host. We were on the same virtual machine at that time. We made them all run through the link service, and we could access each other by name. In the configuration of the code, we also allow them to access each other by name, but in the current situation, we have two slave,1 master, and when we run any of these configurations, we may be assigned to one of the slave, so there must be a problem with the link mechanism that comes with docker. Source code: https://github.com/limingios/msA-docker mesos branch
Service Discovery of mesos
Based on the discovery mechanism of marathon-lb, it needs to define a service port for each service and register it on marathon-lb. When we access the marathon-lb, we will forward it to the ip and port of the service provider. In a more centralized service discovery, all services are found through marathon-lb. The difference between them is that the port is different.
Mesos-dns, which discovers services by name, is based on the principle that multiple slave machines need to run mesos-dns and get the corresponding ip and port number of each service by interacting with mesos. Add a record on this machine to facilitate mutual access, but mesos-dns has not been updated in hub.docker.com for more than two years. This way has been abandoned. Use the first method.
Since the mechanism of the service is different from the previous one, our code must be adjusted. Next I will change it together.
Modify the way the configuration file adapts to mesos
A six-microservice. One by one. Come on.
Message-thrift-python-service
9090 provided to the outside world, it is internal to the service. Because it does not need to access any services, there is no need to modify the configuration.
User-thrift-service
The mysql inside is a common component that does not need to be modified, it does not need to rely on any services, and it does not need to modify the configuration.
User-edge-service
The redis inside is a common component and does not need to be modified.
Access through the domain name, and then bind a host to each slave machine
Server.name=user-edge-serviceserver.port=8082thrift.user.ip=lb.idig88.com#thrift.user.ip=127.0.0.1thrift.user.port=10001thrift.message.ip=lb.idig88.comthrift.message.port=10002#redis configspring.redis.host=$ {redis.address} # spring.redis.host=127.0.0.1spring.redis.port=6379spring.redis.password=limingspring.redis.timeout=30000
User-edge-service-client
No profile does not need to be considered.
Course-edge-service
Modify the configuration file
Server.port=8081#dubbo configspring.dubbo.application.name=course-dubbo-servicespring.dubbo.registry.address=zookeeper://$ {zookeeper.address}: 2181#spring.dubbo.registry.address=zookeeper://127.0.0.1:2181spring.dubbo.scan=com.idig8.courseuser.edge.service.addr=lb.idig88.com:10003course-dubbo-service
Zookeeper and mysql common components do not need to be modified
# dubbo configuration spring.dubbo.application.name=course-dubbo-servicespring.dubbo.registry.address=zookeeper://$ {zookeeper.address}: configuration of 2181#spring.dubbo.registry.address=zookeeper://127.0.0.1:2181spring.dubbo.protocol.name=dubbospring.dubbo.protocol.port=20880#spring.dubbo.protocol.host=127.0.0.1spring.dubbo.scan=com.idig8.course# data source spring.datasource.url=jdbc:mysql://$ {mysql.address}: 3306/db_course#spring.datasource. Url=jdbc:mysql://127.0.0.1:3306/db_coursespring.datasource.username=rootspring.datasource.password=rootspring.datasource.driver-class-name=com.mysql.jdbc.Driverthrift.user.ip=lb.idig88.com#thrift.user.ip=127.0.0.1thrift.user.port=10001gataway-zuulserver: port: 8080spring: application: name: gateway-zuu cloud: gateway: routes:-id: course-edge-service uri: http://lb.idig88.com: 10004 predicates:-Path=/course/**-id: user-edge-service uri: http://lb.idig88.com:10003 predicates:-Path=/user/**logging: level: org.springframework.cloud.gateway: debug Port relationship list
There are six micro-services, the middle two services can be controlled by dubbo, the service is registered with zookeeper, and the caller can obtain the service address through zookeeper, so we don't need to care about what the service discovers, so five services is enough.
# Service name = new port / old port user-thrift-service=10001/7911message-thrift-python-service=10002/9000user.edge.service=10003/8082course-edge-service=10004/8081gayway-zuul-service=10005:
PS: the micro-service adjustment of the code has been completed, and the next step is to connect to mesos and start deployment.
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.