当前位置:网站首页>Microservice system architecture construction I: Environment Construction

Microservice system architecture construction I: Environment Construction

2022-06-13 08:14:00 Dreams Of blue

1, install docker

1 Before uninstalling the system docker 
sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

2   Setup repository
sudo yum install -y yum-utils
sudo yum-config-manager \
    --add-repo \
    https://download.docker.com/linux/centos/docker-ce.repo

3   install DOCKER engine
sudo yum install docker-ce docker-ce-cli containerd.io

4   start-up Docker.
sudo systemctl start docker

5 Configure image acceleration
sudo mkdir -p /etc/docker
sudo tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["https://chqac97z.mirror.aliyuncs.com"]
}
EOF
sudo systemctl daemon-reload
sudo systemctl restart docker

start-up docker

systemctl start docker

2, install redis

1 stay docker hub Search for redis Mirror image
docker search redis

2 Pull redis Mirror to local
docker pull redis:6.0.10

3 Modify the configuration that needs to be customized (docker-redis There is no configuration file by default ,
Mount the mapping after the host is established )
Create and modify /usr/local/redis/redis.conf
bind 0.0.0.0 Open remote permissions
appendonly yes Turn on aof Persistence

4 start-up redis Service run container , Start the container
docker run --name redis  -v /usr/local/redis/data:/data  -v /usr/local/redis/redis.conf:/usr/local/etc/redis/redis.conf -p 6379:6379 -d redis:6.0.10  redis-server /usr/local/etc/redis/redis.conf 

explain : -v /usr/local/redis/data:/data  # Hang the data directory locally to ensure data security
 -v /root/redis/redis.conf:/usr/local/etc/redis/redis.conf   # Hang the configuration file locally for easy modification
 
5   Go straight in redis client .
docker exec -it redis redis-cli

6 Local remote connection redis

7 You need to open the firewall on Tencent cloud to pass

8  Set up redis The account and password of the connection

3, install postgresql        

Web link

docker install postgresql_ My guest, here comes the wine blog -CSDN Blog _docker postgresql

account number :postgres  password :password

1. Inquire about postgresql Mirror image

docker search postgres

2. Pull image file  

docker pull postgres:14.2

3, Create folder

mkdir postgresql

4, Start the container , And set the password

docker run --name postgres \
    --restart=always \
    -e POSTGRES_PASSWORD=password \
    -p 5432:5432 \
    -v /data/postgresql:/var/lib/postgresql/data \
    -d postgres:14.2 
5, Turn on the firewall , Provide external access

4, install nacos

The website is

account number :nacos  password :nacosDocker install Nacos Detailed tutorial _ Qiu Feng Xiao Zhu's blog -CSDN Blog _docker install nacos The virtual machine used in this tutorial is centos7. One 、 Pull image 2 、 Start container three 、 test https://blog.csdn.net/qq_44697728/article/details/122677059

1, Pull the mirror image , Install the latest stable version , Be careful , ad locum ,qq The browser does not support displaying visual interfaces

docker pull nacos/nacos-server:2.0.3

2, Start the program

docker  run \
--name nacos -d \
-p 8848:8848 \
--privileged=true \
--restart=always \
-e JVM_XMS=256m \
-e JVM_XMX=256m \
-e MODE=standalone \
-e PREFER_HOST_MODE=hostname \
nacos/nacos-server:2.0.3

5, install rabbitmq

The website is :

【docker install RabbitMQ The detailed steps 】_ A small java blog -CSDN Blog _docker install rabbitmqdocker install RabbitMQ The detailed steps 1. start-up rabbitmqcd /opt/rabbitmqmkdir data# Pull the mirror image docker pull rabbitmq# Look at the mirror image docker images# Pull the image to the local warehouse , Here is the direct installation of the latest ,# If you need to install other versions, you can install them in rabbitmq Just follow the version number # docker pull rabbitmq# start-up rabbitMqdocker run -d \-v /opt/rabbitmq/data:/var/lib/rabbithttps://blog.csdn.net/qq_38066812/article/details/122476744

cd /opt/rabbitmq
mkdir data
# Pull the mirror image
docker pull rabbitmq:3-management
# Look at the mirror image
docker images


# start-up rabbitMq
docker run -d \
-v /opt/rabbitmq/data:/var/lib/rabbitmq \
-p 5672:5672 -p 15672:15672 --name rabbitmq --restart=always \
--hostname myRabbit rabbitmq:3-management

# start-up rabbitmq_management, rabbitmq For the name of the container , Use id It's fine too
docker exec -it rabbitmq rabbitmq-plugins enable rabbitmq_management
# ip+ Port number login , The user name and password default to guest

Browser access http://192.168.124.129:15672

Initial account password guest guest

6, install nginx

7, install sentinal

website :

docker install Sentinel_LOYURU The blog of -CSDN Blog _docker install sentinel Reference documents :https://blog.csdn.net/qiuchenxinlu/article/details/123114456

Pull the mirror image :

docker pull bladex/sentinel-dashboard

start-up :

docker run --name sentinel -d -p 8858:8858 -d bladex/sentinel-dashboard

8, install seata

docker install seata1.5_LOYURU The blog of -CSDN Blog _docker install seata1. Get mirror image docker pull seataio/seata-server2. Run the container and get the configuration for our convenience seata To modify the configuration, we need to run seata-server, Then copy the configuration to the host , When finished, delete the previous configuration and run the container through the host .## Run container docker run --name seata-server -p 8091:8091 -d seataio/seata-server:latest## Copy the configuration in the container to /usr/local/seatadocker cp seata-sehttps://blog.csdn.net/qiuchenxinlu/article/details/123114433

Distributed transaction solutions :Spring Cloud + Nacos + Seata Integrate - cloud + Community - Tencent cloud Seata Is an open source distributed transaction solution , We are committed to providing high-performance and easy-to-use distributed transaction services under the microservice architecture .https://cloud.tencent.com/developer/article/1998363?from=10680

Integration through practice :

ad locum , To specify seata Version of , Specify the database as postgresql, Whether to specify kafka Log version of

Operation steps :

9, install zipkin Link tracking

Docker install Zipkin_ Starry night Gufan's blog -CSDN Blog _docker install zipkin One 、Zipkin The introduction passed Seuth Generated call chain monitoring information , You can know the call link between microservices , However, the monitoring information is only output to the console, which is inconvenient to view . We need a graphical tool zipkin.Zipkin yes Twitter Open source distributed tracking system , It is mainly used to collect the time data of the system , To track system calls .zipkin The official website is as follows: : Official website II 、Docker install Zipkindocker run -d -p 9411:9411 openzipkin/zipkin 3、 ... and 、 Integrate Zipkin3.1 Introduce dependencies 3.2 add to Zhttps://blog.csdn.net/qq_38826019/article/details/115442287

 docker run -d -p 9411:9411 openzipkin/zipkin

原网站

版权声明
本文为[Dreams Of blue]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/164/202206130809462811.html