Docker installation uses Rancher

1. Download Mirror

Rancher is an enterprise Kubernetes management platform that meets the needs of DevOps teams deploying applications using Kubernetes and IT personnel delivering enterprise critical services

# 1. Pull the rancher image
docker pull rancher/server
# 2. Start rancher
docker run -id --name rancher -p 9090:8080 rancher/server

2. Rancher initialization

  • 2.1 Add environment default-===>Environment management (test environment, production environment)

  • 2.2 Add Host Infrastructure==>Host (Add Host)
  • Preservation

  • Close the interface after running and display information about the new host
  • 2.3 Add Applications
    Click Apply==>All (or Users) Click Add Button
  • 2.4 Application Deployment Add Service
  • Configure mysql:

  • Configure RabbitMq deployment
    Mirror: docker pull rabbitmq:3.7.7-management (management with graphical interface)
    Port: 5671,5672,4369,15671,15672,25672
    Add environment variables: user name, password


3. Deploy micro-service applications

  • View service status, accessible

4. Expansion and contraction

  • 4.1 Delete the base-service microservice created in Rancher
  • 4.2 Re-establish base-service without configuring port mappings
  • 4.3 Add Receiver
    API===>Webhooks===>Add Receiver

    Extensions can be triggered by post requests:

  • 4.4 Configuration Load Balancing is an externally accessible application
    Add Service==>> Add Load Balancing

    Normal access after startup

5. influxDB

InfluxDB (Time Series Database), a common use scenario: monitoring data statistics. Record your computer's memory usage every millisecond, and use the graphical interface (InfluxDB V1 generally works with Grafana) to make a line chart of your memory usage based on statistical data

  • 5.1 influxDB installation
# 1. Pull mirror
docker pull tutum/influxdb
# 2. Run
docker run -di -p 8083:8083 -p 8086:8086 --expose 8090 --expose 8099 --name influxsrv tutum/influxdb
  • Port 8083 web access port, 8086 data write port
  • 5.2 influxDB Common Operations
  • 5.2.1 Creating a database

  • 5.2.2 Create a user name and authorize
# 1. 
# 2. Viewing user information
# 3. Authorization
GRANT ALL PRIVILEGES ON cadvisor to cadvisor
grant write on cadvisor to cadvisor
grant read on cadvisor to cad cadvisor
  • 5.2.3 Viewing collected data

6. cadvisor

The problem with docker stats (storage, display), Google's open source cadvisor was born. The cadvisor not only collects information about all the containers running on a machine, but also provides a basic query interface and http interface to facilitate data capture by other components such as Prometheus, cadvisor + influxdb + grafna

  • 6.1 Installation
# 1. Pull mirror
docker pull google/cadvisor
# 2. Run Containers
docker run \
  --volume=/:/rootfs:ro \
  --volume=/var/run:/var/run:ro \
  --volume=/sys:/sys:ro \
  --volume=/var/lib/docker/:/var/lib/docker:ro \
  --volume=/dev/disk/:/dev/disk:ro \
  --publish=8088:8080 \
  --detach=true \
  --link influxsrv:influxsrv \
  --name=cadvisor \
     google/cadvisor \
  --storage_driver=influxdb \
  --storage_driver_db=cadvisor \
  • 6.2 Access

    Can view data

Tags: Operation & Maintenance Docker Nginx

Posted on Sun, 21 Nov 2021 03:18:19 -0500 by joe_C_nice