Docker application deployment Record (Docker contains complete installation procedure)
Foreword
First talk about the source of this article. IOT before I took over a project, you need to install multiple central control server. Central control server needs to be installed RabbitMQ, Mysql, multiple services, these deployments, deployment of personnel is not likely (after all, the hardware part-time), so I can only give the whole a simpler solution. I had to think of the container deployment, and then a whole cluster container (not plastic surgery though I left Shihai cluster).
The benefits of using Docker deployments, greatly reducing deployment complexity. RabbitMQ as native deployment, you need to install erlang language, then compile and install, but also error-prone. docker takes only one instruction (even in order to simplify the operation, I will account password initialization, and also placed in this instruction, and opened a self-starting, etc.).
So, by Docker, to achieve a more fool-deploy, and simple solutions, so it is also useful. In particular, some small and medium sized projects, small partners with similar needs more worthy of recommendation, especially command parameters.
And this blog post gives a perfect Docker installation steps.
Finally, remember what it was when I was new to the container. Hey.
First, install Docker:
1. Requirements: CentOS7 system
2. Check the system kernel:
uname -r
3. Use root authority to ensure that the yum package up to date:
sudo yum update
4. [Optional] uninstall the old version:
sudo yum remove docker docker-common docker-selinux docker-engine
5. Install the required packages:
sudo yum install -y yum-utils device-mapper-persistent-data
6. Set yum Source:
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
7. Check all versions warehouses all docker, and choose to install:
yum list docker-ce --showduplicates | sort -r
8. Installation Docker:
sudo yum install docker-ce
9. Start and join the boot:
systemctl start docker
sudo systemctl enable docker
10. Verify that the installation was successful:
docker version
Second, install RabbitMQ:
1. Install RabbitMQ (restart instruction to ensure that start automatically, modify the default user name and password):
docker run -d --hostname my-rabbit -d --name rabbit -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=123456 -p 5672:5672 -p 15672:15672 rabbitmq:3.7-management
2. Verify that the installation was successful:
Third, the installation Redis:
1. Install (restart instruction to ensure automatic start, no password, no persistence):
docker run --name my-redis -d --restart=unless-stopped -p 6379:6379 -d redis:3.2 redis-server
2. Verify that the installation was successful:
Fourth, the installation Mysql:
1. Installation (restart instruction to ensure automatic startup, set the root password is 123456, Renewable new user, the password of the container 123. elevate permissions):
docker run --name my-mysql -d --restart=unless-stopped --privileged=true -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_USER=”renewable” -e MYSQL_PASSWORD=”123” -d mysql:5.6
2. Verify the installation was successful:
Server check:
connected to the root user check:
Customize the user connection check:
3. Tip:
The above problem may be added unsuccessful connection parameter mirror
--default-authentication-plugin=mysql_native_password
4. Note:
Native installation is recommended, if the container deployment, strict compliance with the installation process. Otherwise, abnormal repair will be very troublesome.
Fifth, install JDK:
After consideration, the container will not consider the deployment of JDK.
After the service of the vessel, the vessel can consider the deployment of JDK.
Six vessels deployed outside the installation:
1. JDK installation
2. Mysql data structure into the
3 (routing rabbitmq the like automatically by the program)
4. (redis data structures, etc., automatically by the program)
5. Nginx deployment:
(Because it is centos7, it is possible to install yum)
(as a result of a repo process, it may be directly mounted nginx)
(otherwise need to install nginx source)
yum install nginx
Start and open from the start:
systemctl start nginx
systemctl enable nginx
verification:
Nginx default path:
- Nginx configuration path: / etc / nginx /
- PID directory: /var/run/nginx.pid
- Error Log: /var/log/nginx/error.log
- Access logs: /var/log/nginx/access.log
- Default site directory: / usr / share / nginx / html
Seven application jar package deployment:
This section is not open. You small partners, according to their needs, to process it.
If you have any questions, you can private letter or @ me.
We were willing to work with the party of progress.