####docker compose####
Docker Docker-Compose official project is an open source project, responsible for fast layout of Docker container cluster, haproxy for load balancing management.
# Compose-mounted Docker
# two questions: pip2 given to install pip3, given the use of a local source watercress source
[mangge01 the root @ ~] # yum the install the sudo to python3-PIP
[mangge01 the root @ ~] # PIP3 the install Docker Compose -i-HTTPS : //pypi.douban.com/simple
[mangge01 the root @ ~] # yum the install the bash-Completion -Y
# docker-compose and arranged HAProxy
[@ mangge01 the root opt] # pwd
/ opt
[@ mangge01 the root opt] LS #
Docker haproxy.cfg index1.html index2.html -compose.yml
# profile
[@ mangge01 the root opt] CAT # haproxy.cfg
Global
log of local0 127.0.0.1 # log output
log 127.0.0.1 local1 Notice
The maxconn # 4096 the maximum number of connections
Defaults
log global # using the global log
mode http # mode, supports TCP, http, health
option httplog # Enable HTTP requests, session state and timer logging
option dontlognull # no logging enable air connection
timeout connect 5000ms # Set wait for a connection attempt to time the most successful server.
Client 5000ms timeout
timeout Server 5000ms
the listen stats
the bind 0.0.0.0:1080 # load balancing management page
the MODE HTTP
stats enable
stats hide-Version
stats uri / stats #URL suffix
stats auth admin: admin # account password
frontend balance # foreground
bind 0.0.0.0 : 80
default_backend web_backends # default to call back a host of
backend web_backends
the MODE HTTP
the Option forwardfor
Balance the RoundRobin
Server web1 web1: 80 the Check
Server web2 web2: the Check 80
[@ mangge01 the root opt] Docker-CAT # compose.yml
web1:
Image: Nginx
Volumes:
- /opt/index1.html:/usr/share/nginx/html/index.html
EXPOSE:
- Internal Port # 80
web2:
Image : nginx
Volumes:
- /opt/index2.html:/usr/share/nginx/html/index.html
EXPOSE:
- 80
HAProxy:
Image: HAProxy
Volumes:
- /opt/haproxy.cfg:/usr/local/etc/ HAProxy / haproxy.cfg
links:
- web1
- web2
the ports:
- "8888: 1080" # port storm drain
- "8080: 80"
# boot loader configuration file
[root @ mangge01 opt] # docker -compose -f docker-compose. yml up -d
# Browser to access the page
192.168.192.130:8080 # foreground access page, the default web1 and web2 polling
192.168.192.130:8888/stats #haproxy load balancing management page
#### docker log management ####
# Ali cloud - Registration Log - Products & Services - Containers mirror service - Mirror accelerator - / etc / Docker / daemon.json
# own at least 3G test virtual machine memory, or it may fail to start elk
Process #: nginx host using filebeat collection container logs, container elk es transmission by showing kibana
ELK deployment vessel
[amdha01 the root @ ~] # Docker pull sebp / Elk
[amdha01 the root @ ~] # sysctl vm.max_map_count = 262144
[amdha01 the root @ ~] RUN # Docker Expediting IT --rm -p 9200: 9200 5044 -p : 5044 -p 5601: 5601 --name sebp Elk / Elk
# error, the specific forget to address temporary changes take effect immediately
ulimit -n 655350
安装filebeat
[root@node01 ~]# https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-6.1.2-x86_64.rpm
[root@node01 ~]# rpm -ivh filebeat-6.1.2-x86_64.rpm
[root@node01 ~]# vi /etc/filebeat/filebeat.yml
# Change to true to enable this prospector configuration.
enabled: true
#- /var/log/*.log
- /var/lib/docker/*.*/*.log
output.elasticsearch:
# Array of hosts to connect to.
hosts: ["ELK:9200"]
[root@node01 ~]# /etc/init.d/filebeat start