目录

docker常用软件安装

zk集群搭建

zk集群搭建

rocketmq双主双从搭建

使用docker-compose从无到有搭建rocketmq双主双从

mysql

1
2
3
4
5
6
docker run -p 3306:3306 --name mysql \
-v ~/docker/mysql/log:/var/log/mysql \
-v ~/docker/mysql/data:/var/lib/mysql \
-v ~/docker/mysql/conf:/etc/mysql \
-e MYSQL_ROOT_PASSWORD=333 \
-d mysql:5.7

docker-compose.yml:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
version: '3'

services:
  mysql:
    image: mysql:5.7
    environment:
      - MYSQL_ROOT_PASSWORD=333
      - MYSQL_DATABASE=eden
    volumes:
      - ~/docker/mysql01/conf:/etc/mysql/conf.d
      - ~/docker/mysql01/logs:/logs
      - ~/docker/mysql01/data:/var/lib/mysql
    container_name: mysql01
    ports:
      - "3306:3306"

mysql主从搭建

mysql一主一从和双主双从搭建

rabbitmq

1
2
3
4
5
6
7
8
# 15672是管理界面端口
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 \
-v ~/docker/rabbitmq:/var/lib/rabbitmq \
--hostname rabbit \
-e RABBITMQ_DEFAULT_VHOST=eh-vhost  \
-e RABBITMQ_DEFAULT_USER=admin \
-e RABBITMQ_DEFAULT_PASS=admin \
-d rabbitmq:management

nginx

docker-compose安装nginx

nacos集群

docker-compose搭建nacos集群

spring cloud alibaba docker-compose编排文件

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
version: "3"
services:
  mysql:
    image: mysql:5.7.22
    container_name: mysql
    environment:
      - MYSQL_ROOT_PASSWORD=123456
      - TZ=Asia/Shanghai
    volumes:
      - /app/cloud/mysql/data:/var/lib/mysql
      - /etc/localtime:/etc/localtime
    network_mode: host
    ports:
      - 3306:3306
    restart: always
  nacos:
    image: nacos/nacos-server:1.3.0
    container_name: nacos
    environment:
      - PREFER_HOST_MODE=hostname
      - MODE=standalone
      - MYSQL_DATABASE_NUM=1
      - SPRING_DATASOURCE_PLATFORM=mysql
      - MYSQL_SERVICE_HOST=myserver
      - MYSQL_SERVICE_DB_NAME=nacos
      - MYSQL_SERVICE_PORT=3306
      - MYSQL_SERVICE_USER=root
      - MYSQL_SERVICE_PASSWORD=123456
    volumes:
      - /app/cloud/nacos/logs:/home/nacos/logs
    network_mode: host
    ports:
      - 8848:8848
    depends_on:
      - mysql
    restart: always
  sentinel:
    image: bladex/sentinel-dashboard:latest
    container_name: sentinel
    environment:
      - TZ=Asia/Shanghai
    network_mode: host
    ports:
      - 8858:8858
    restart: always
  seata:
    image: seataio/seata-server:1.2.0
    container_name: seata
    environment:
      - SEATA_CONFIG_NAME=file:/root/seata-config/registry
      - SEATA_IP=192.168.80.188
      - TZ=Asia/Shanghai
    volumes:
      - /app/cloud/seata/conf:/root/seata-config
      - /app/cloud/seata/logs:/root/logs
      - /etc/localtime:/etc/localtime
    network_mode: host
    ports:
      - 8091:8091
    depends_on:
      - nacos
    restart: always

mycat

使用dockerfile安装mycat

redis

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# 先要创建好文件~/docker/redis/conf/redis.conf,否则会将redis.conf当成目录创建
$ docker run -p 6379:6379 --name redis \
-v ~/docker/redis/data:/data \
-v ~/docker/redis/conf/redis.conf:/etc/redis/redis.conf \
-d redis:6.0.8 \
redis-server /etc/redis/redis.conf

# 执行
$ de c1 redis-cli
# 持久化设置,在redis.conf文件增加下面这一行
appendonly yes