In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Module 1: combination of Docker and aggregator
1.1 Overview of the combination of Docker and aggregator
The combination of aggregator cluster and docker can carry out efficient operation, reasonable resource allocation and management. After the combination, the structure is divided into two parts: Server side and Client side; Docker Server side can only be used in Linux.
1.2 Docker Port
What we need to understand is that Docker management involves three ports: communication ports, mapping external ports, and mapping internal ports. Among them, dockerManager and dockerServer communicate with each other through communication ports; Docker accesses esprocs services by mapping external ports; and esprocs services use mapped internal ports.
1.3 two corresponding relations
1) there is an one-to-one correspondence between the Docker machine and the node machine of the aggregator cluster, which is distinguished by the host and the port, and the internal and external ports of the docker mapping are the same. Therefore, on the same physical machine, the port requirements used by users are not occupied and unique. The use of Docker on the Server side is divided into one physical machine and multiple physical machines. We simply understand the corresponding relationship between ip:port and docker as 1:1.
2) the Server terminal is divided into dockerManager and dockerServer, and dockerManager manages the network connection, which is the entrance of the network, responsible for the login inspection of users, the management (startup and shutdown) of other related docker machines, and the copying of user configuration information to docker; dockerServer does not communicate directly with the client side, but only communicates with dockerManger, it is only responsible for starting and shutting down docker, which is managed by dockerManager, and dockerServer and dockerManager are dockerManager 1 relationship.
Module 2: administrator configures Server side
On the server side, the docker administrator manages and allocates the resources used by docker_user.xml, docker_server.xml, unitServer.xml and users.
2.1 Directory mapping relationship between host and docker container
Host directory Dokcer container directory description / home/docker/share/share global shared directory / opt/app/aaa/app user home directory / opt/app/aaa/ demo/demo user directory / opt/app/aaa/ data/app/data user directory / opt/app/aaa/ config/app/config user directory
2.2 the startup script automatically copies the configuration file
The administrator configures two files under the esProc/config directory of the host aggregator:
RaqsoftConfig.xml [Authorization profile]
UnitServer.xml [cluster profile that allocates ip:port resources]
The dokcer startup script executes the following command in the docker container:
Cp / app/config/raqsoftConfig.xml.. / config
Cp / app/config/unitServer.xml.. / config
Copy the two configuration files under the host ${home} / config/ (corresponding to the / app/config directory in the docker container) to the aggregator configuration directory in docker.
2.3 configure docker_server server management
Example docker_server.xml configuration:
192.168.0.186:9001 / home/docker/share manager 192.168.0.186:9001 / home/docker/share manager
Description:
The label is the IP and port number when the client port accesses the Server port. The example is as follows:
Label as shared directory
2.4 configure the configuration file used by the aggregator in docker:
Example raqsoftConfig.xml configuration:
Description:
Here the / share path is the shared directory specified by the label (mapping directory)
The shared directory ${sharePath} of the host is mounted when docker starts, and the mapping relationship is:-v ${sharePath}: / share:ro. This directory is mounted to the / share directory of the docker container, and the files under the docker shared directory / share are automatically copied to the aggregator configuration directory under docker.
UnitServer.xml configuration example
Description:
The tag attribute of manager indicates that this physical machine is an import machine.
2.4.1 scenario 1: a physical machine is configured with one or more docker
Configure the tag attribute to manager
2.4.2 scenario 2: multiple physical machines are configured with multiple docker
Physical machines communicate with each other, so communication port 9001 (or other ports) is required to be consistent
The configuration tag attribute of the import machine is manager.
Other physical machines do not have tags.
2.5 configure docker_user.xml user Management
Aaa Zhang San 123456 500m 512 / opt/app/aaa 192.168.0.76 bbb Li Si 123456 500m 512 / opt/app/bbb 192.168.0.77V 8282192.168.0.77V 8283. Aaa Zhang San 123456 500m 512 / opt/app/aaa 192.168.0.76 bbb Li Si 123456 500m 512 / opt/app/bbb 192.168.0.77V 8282192.168.0.77V 8283.
The tag is the user name when the Client side accesses the Server side. It is required to be unique, preferably in English. When using docker, users with the same name are not allowed to use at the same time.
The label is the password when the Client side accesses the Server side.
The tag is an alias of the user name, which makes it easy for the user to distinguish memory.
To use a minimum of 4m, you need to add a unit m after the parameter
It is required to be readable and writable for the location that users store on the host. It is divided into three directories: config, demo and data, corresponding to configuration files, dfx files and data files, respectively.
The label is the docker mapping (internal and external) port, that is, the Client side accesses the aggregator IP and port on the Server side.
2.5.1 scenario 1: a physical machine is configured with one or more docker
192.168.0.76:8282192.168.0.76:8283192.168.0.76:8282192.168.0.76:8283
2.5.2 scenario 2: multiple physical machines are configured with multiple docker
192.168.0.76:8281192.168.0.77:8282192.168.0.77:8283 . 192.168.0.76:8281192.168.0.77:8282192.168.0.77:8283 . 3 enable Server side
3.1 deployment of Java running packages on server
The relative relationship between the server launcher server.sh and its related program directories is shown in the following figure:
3.2 Image installation uses:
Go to the directory where the esproc image file esproc.tar.gz is located, decompress it and then publish the image
Tar-zxvf esproc.tar.gz; docker load-I esproc.tar
3.3 Image installation uses:
#. / server.sh
3.4 Image installation uses:
# kill-9 docker_pid
3.5 Image installation uses:
1.docker logs-Container
Docker logs can print out the complete log since the container is started, and the location is stored / var/lib/docker/containers
$docker logs [OPTIONS] CONTAINER
Options:
-details displays more information
-f,-follow trace log output, the log of the current timestamp of the last behavior
-since string displays logs from a specific time or time period
-tail string displays how many lines of logs from the end of the log. Default is all.
-t,-timestamps displays the timestamp
2.docker Management Service Log
The location of the Docker daemon log can be viewed according to different systems:
Ubuntu-/ var/log/upstart/docker.log
Boot2Docker-/ var/log/docker.log
Debian GNU/Linux-/ var/log/daemon.log
CentOS-/ var/log/daemon.log | grep docker
3.5 Image installation uses:
1.dokcer port occupancy conflict
Solution:
First, change the port number
Second, delete the conflicting port number.
Delete conflicting ports as follows:
-View the rules of all chains in the nat table:
Iptables-t nat-nL-line-number | grep 80 (e.g. port 80)
Chain DOCKER (2 references)
Target prot opt source destination
DNAT tcp-0.0.0.0 DNAT tcp 0 0.0.0.0 Universe 0 tcp dpt:80 to:172.17.0.2:8080
DNAT tcp-0.0.0.0 DNAT tcp 0 0.0.0.0 Universe 0 tcp dpt:80 to:172.17.0.9:8080
-Delete conflicting ports:
Iptables-t nat-D DOCKER 2 removes the second rule from chain docker
2.Docker zombie process
-cause: the child process exits, and the parent process does not call wait or waitpid to obtain the status information of the child process, so the process descriptor of the child process is still saved in the system, which is called a zombie process.
-the docker container on the host machine is jammed. The solution:
Ps-ef | grep defunct
Ps-ef | grep-w 'Z' # find the zombie process
It is difficult to kill a zombie process directly, so you can try to kill the parent process of the zombie process:
Ps-e-o ppid,stat | grep Z | awk-F "'{print $1}'| xargs kill-9
-the zombie process in the container
Many people now use docker to run only one process in the container. In most cases, this process will not have the behavior of an init process, and there will be no init process to take over the zombie process, so add an init process when docker starts, which can be used to receive orphan processes.
Docker run-init your_image_here
3.dockerServer failure problem
Dockerserver failure problem
A.docker service failed to view log
Systemctl status docker.service
-detailed log
Journalctl-xe
-restart the service
Systemctl daemon-reload
Systemctl start docker.service
b. Failed to start the container. Check the reason for the failure according to the log.
Docker log
4.docker did not exit normally
-View container running status and log
Docker ps-a
Docker logs CONTAINER
-possible reasons:
The main thread of the docker container (the command executed by CMD in dockfile) ends and the container exits
-background mode and tty options are recommended
Docker run-dit [CONTAINER_NAME or CONTAINER_ID]
-the Docker container runs in Daemonized mode in the background, which can be achieved by adding the-d parameter. In the following example, the container will not commit suicide without doing anything.
Sudo docker run-d ubuntu:14.04 / bin/sh-c "while true; do echo hello world; sleep 1; done"
The administrator operates the help file:
DockerServerzip
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.