Docker 学习-用到的环境
备份
docker备份容器到本地(以及恢复)
https://blog.csdn.net/qq_20042935/article/details/106495071
环境篇
Redis
: docker pull redis
(Docker内安装Redis,docker容器连接不上redis容器,解决方案)
修改redis.conf 文件 然后使用命令上传到docker 容器内
https://blog.csdn.net/qq_38363738/article/details/106785711
https://blog.csdn.net/dwwwwww/article/details/113820794
redis配置文件
https://github.com/redis/redis/blob/6.0.10/redis.conf
=============
Kafka
:基于Docker使用Kafka队列 进行批量写入
参考
单个安装“
https://blog.csdn.net/u014796929/article/details/123508090
https://blog.csdn.net/u012796085/article/details/118294367
安装
1、安装 zookeeper
docker pull wurstmeister/zookeeper
1.1、运行 zookeeper
docker run -d --name zookeeper --publish 2181:2181 --volume /etc/localtime:/etc/localtime wurstmeister/zookeeper
2 、安装 kafka
docker pull wurstmeister/kafka:2.11-0.11.0.3
2.1、 启动kafka
docker run -d --name kafka --publish 9092:9092 --link zookeeper --env KAFKA_HEAP_OPTS=-Xmx1G --env KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 --env KAFKA_ADVERTISED_HOST_NAME=localhost --env KAFKA_ADVERTISED_PORT=9092 --volume /etc/localtime:/etc/localtime wurstmeister/kafka:2.11-0.11.0.3
注意事项
注意 KAFKA_ADVERTISED_HOST_NAME= (我使用的是Localhost)但是你安装可能会报错
- 如果发现是连接zookeeper失败检查是否使用了localhost,改为ip
yml
集群安装 172.16.16.4 换成本地 ip 或者 localhost
version: '3.8'
services:
zookeeper:
image: wurstmeister/zookeeper
container_name: zookeeper
ports:
- "2181:2181"
restart: always
kafka1:
image: wurstmeister/kafka
depends_on: [ zookeeper ]
container_name: kafka1
ports:
- "9091:9091"
environment:
HOSTNAME: kafka1
KAFKA_BROKER_ID: 0
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka1:9091
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9091
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181/kafka
extra_hosts:
kafka1: 172.16.16.4
kafka2:
image: wurstmeister/kafka
depends_on: [ zookeeper ]
container_name: kafka2
ports:
- "9092:9092"
environment:
HOSTNAME: kafka2
KAFKA_BROKER_ID: 1
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka2:9092
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9092
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181/kafka
extra_hosts:
kafka2: 172.16.16.4
kafka3:
image: wurstmeister/kafka
depends_on: [ zookeeper ]
container_name: kafka3
ports:
- "9093:9093"
environment:
HOSTNAME: kafka3
KAFKA_BROKER_ID: 2
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka3:9093
KAFKA_LISTENERS: PLAINTEXT://0.0.0.0:9093
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181/kafka
extra_hosts:
kafka3: 172.16.16.4
RabbitMQ
安装
docker pull rabbitmq
docker rabbitmq 启动
docker run -d -p 15672:15672 -p 5672:5672 -e RABBITMQ_DEFAULT_USER=admin -e RABBITMQ_DEFAULT_PASS=admin12@qq --name rabbitmq --hostname=rabbitmqhostone rabbitmq