1

一、kafka docker-compose.yml 文件

version: '2'
services:
  zookeeper:
    image: wurstmeister/zookeeper
    ports:
      - "2181:2181"
  kafka:
    image: wurstmeister/kafka:2.11-0.11.0.3
    ports:
      - "9092:9092"
    environment:
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://selton.cn:9092
      KAFKA_LISTENERS: PLAINTEXT://:9092
      KAFKA_ZOOKEEPER_CONNECT: selton.cn:2181
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock

二、NSQ docker-compose.yml 文件

version: '3'
services:
  nsqlookupd:
    image: nsqio/nsq
    command: /nsqlookupd
    ports:
      - "4160:4160"
      - "4161:4161"

  nsqd:
    image: nsqio/nsq
    command: /nsqd --lookupd-tcp-address=nsqlookupd:4160
    depends_on:
      - nsqlookupd
    ports:
      - "4150:4150"
      - "4151:4151"

  nsqadmin:
    image: nsqio/nsq
    command: /nsqadmin --lookupd-http-address=nsqlookupd:4161
    depends_on:
      - nsqlookupd
    ports:
      - "4171:4171"

三、docker-compose 快速部署mysql和redis
创建docker-compose.yml文件,并填写如下配置。

version: '3'
services:
  mysql:
    restart: always
    privileged: true
    image: mysql:5.7.16
    container_name: mysqlServer
    volumes:
      - ./db:/var/lib/mysql
      - ./conf/:/etc/mysql/conf.d
      - ./logs:/logs
    environment:
      MYSQL_ROOT_PASSWORD: "123456"
      MYSQL_INITDB_SKIP_TZINFO: "Asia/Shanghai"
    ports:
      - "33106:3306"
    network_mode: "bridge"
  redis-dev:
    image: redis:5.0.4
    container_name: redis
    hostname: localhost
    network_mode: bridge
    command: redis-server /etc/redis.conf    #启动redis命令
    volumes:
      - ./redis/redis.conf:/etc/redis.conf
    ports:
      - "6379:6379"

常用命令总结:

##启动组件
docker-compose up

# 注意文件名一定是 docker-compose.yml才能运行成功,
#若不是这个文件名,则需要指定文件名, filename 对应文件名
docker-compose -f filename up

# 关闭docker-compose 服务
docker-compose down

# 或者
docker-compose -f filename down

其他常用命令可以通过 docker-compose --help查看

Docker 启动mysql命令详解

docker run -p 3306:3306 --name mysql \                 启动mysql容器,映射端口,换行
-v /usr/local/docker/mysql/conf:/etc/mysql \         设置配置文件数据卷(映射配置目录)
-v /usr/local/docker/mysql/logs:/var/log/mysql \      设置日志文件数据卷
-v /usr/local/docker/mysql/data:/var/lib/mysql \      设置数据文件数据卷
-e MYSQL_ROOT_PASSWORD=root \                          设置数据库访问root密码
-d mysql                                              镜像名称


docker run -p 3306:3306 --name mysql
-v /usr/local/docker/mysql/conf:/etc/mysql
-v /usr/local/docker/mysql/logs:/var/log/mysql
-v /usr/local/docker/mysql/data:/var/lib/mysql
-e MYSQL_ROOT_PASSWORD=root
-d mysql:5.7.22


####Docker 启动 Redis
docker run --name redis -d -p 6379:6379 redis
docker run -p 6379:6379 --name redis -d redis:latest redis-server
docker run -p 6379:6379 --name redis22 -d redis:5.0.4 redis-server

Clickhouse 安装:

docker run -d --name=clickhouse-server \
-p 8123:8123 -p 9009:9009 -p 9090:9000 \
--ulimit nofile=262144:262144 \
-v /data/clickhouse/conf/config.xml:/etc/clickhouse-server/config.xml \
-v /data/clickhouse/conf/users.xml:/etc/clickhouse-server/users.xml \
-v /data/clickhouse/log:/var/log/clickhouse-server \
-v /data/docker/store:/var/lib/clickhouse/store \
yandex/clickhouse-server:22.1.2.2

https://blog.csdn.net/kinshy/...
https://segmentfault.com/a/11...

安装 K8S
https://github.com/AliyunCont...

Docker 下安装微服务链追踪工具 zipkin jaeger:

docker pull openzipkin/zipkin
docker  pull  jaegertracing/all-in-one

docker run -d -p 9411:9411 openzipkin/zipkin
docker run -d -p 5775:5775/udp -p 16686:16686 -p 14250:14250 -p 14268:14268 jaegertracing/all-in-one:latest

[K8S 官方文档](https://kubernetes.io/zh-cn/d...)
参考: https://blog.csdn.net/oschina...


goper
413 声望26 粉丝

go 后端开发