Docker容器
# Docker启动
systemctl start docker
# Docker容器关闭开机自启
docker update --restart=no 容器id
# 容器安装
# Portainer
拉取镜像
docker pull portainer/portainer
1设置开机自启
docker run -d --restart=always --name portainer -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer
1访问 Portainer
地址:
ip:9000
用户名:admin
密码:******
# kafka
配合zookeeper
拉取镜像
docker pull wurstmeister/zookeeper docker pull wurstmeister/kafka
1
2启动zookeeper
docker run -d --name zookeeper -p 2181:2181 -t wurstmeister/zookeeper
1启动kafka
docker run -d --name kafka --publish 9092:9092 --link zookeeper --env KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 --env KAFKA_ADVERTISED_HOST_NAME=192.168.30.131 --env KAFKA_ADVERTISED_PORT=9092 --volume /etc/localtime:/etc/localtime wurstmeister/kafka:latest
1创建topic
[root@nrStudy ~]# docker exec kafka \ > kafka-topics.sh \ > --create --topic hello \ > --partitions 1 \ > --zookeeper zookeeper:2181 \ > --replication-factor 1 Created topic hello.
1
2
3
4
5
6
7查看topic
[root@nrStudy ~]# docker exec kafka kafka-topics.sh --list --zookeeper zookeeper:2181 hello hello
1
2