|
一、创建容器间专用网络
- vim /etc/sysctl.conf
- net.ipv4.ip_forward=1
- systemctl restart network
- sysctl net.ipv4.ip_forward
复制代码
- docker network create -d macvlan --subnet=192.168.100.0/24 --ip-range=192.168.100.0/24 -o macvlan_mode=bridge -o parent=ens33 macvlan
复制代码
二、常用工具安装
1、redis(单机版本)- sudo docker pull redis
- sudo mkdir -p /data/redis/conf
- sudo mkdir -p /data/redis/data
- sudo sed -i 's/bind 127.0.0.1$/bind 0.0.0.0/g' /data/redis/conf/redis.conf
- sudo sed -i 's/# requirepass foobared$/requirepass PanSi@98Dw/g' /data/redis/conf/redis.conf
- sudo docker run -d --privileged=true -m 512M --net macvlan --ip 192.168.100.100 --restart always -v /data/redis/conf/redis.conf:/etc/redis/redis.conf -v/data/redis/data:/data --name redis redis redis-server /etc/redis/redis.conf --appendonly yes
复制代码
2、Mysql安装
- sudo mkdir -p /data/mysql/
- docker run --net macvlan --ip 192.168.100.101 --restart always -m 512M --name mysql -v /data/mysql/data:/var/lib/mysql -v /data/mysql/conf:/etc/mysql/conf.d -v /data/mysql/log:/var/log/mysql -e MYSQL_ROOT_PASSWORD=root -d mysql
复制代码
3、pulsar 单机版安装
1) 使用独立网络
- docker run -d --restart always -m 1024M --net macvlan --ip 192.168.100.102 --name pulsar-standalone apachepulsar/pulsar sh -c "bin/pulsar standalone > pulsar.log 2>&1 & sleep 30 && bin/pulsar-admin clusters update standalone --url http://192.168.100.102:8080 --broker-url pulsar://192.168.100.102:6650 & tail -F pulsar.log"
- docker run -d --restart always -m 512M --net macvlan --ip 192.168.100.103 --name pulsar-manager -e SPRING\_CONFIGURATION\_FILE=/pulsar-manager/pulsar-manager/application.properties --entrypoint="" apachepulsar/pulsar-manager sh -c "sed -i '/^default.environment.name/ s|.\*|default.environment.name=pulsar-standalone|' /pulsar-manager/pulsar-manager/application.properties & sed -i '/^default.environment.service\_url/ s|.\*|default.environment.service\_url=http://192.168.100.102:8080|' /pulsar-manager/pulsar-manager/application.properties & /pulsar-manager/entrypoint.sh & tail -F /pulsar-manager/pulsar-manager/pulsar-manager.log"
复制代码 2)使用主机网络
- docker run -itd --name pulsar-standalone -p 6650:6650 -p 8080:8080 apachepulsar/pulsar sh -c "bin/pulsar standalone > pulsar.log 2>&1 & sleep 30 && bin/pulsar-admin clusters update standalone --url http://pulsar-standalone:8080 --broker-url pulsar://pulsar-standalone:6650 & tail -F pulsar.log"
- docker run -itd --name pulsar-manager -p 9527:9527 -p 7750:7750 -e SPRING\_CONFIGURATION\_FILE=/pulsar-manager/pulsar-manager/application.properties --link pulsar-standalone --entrypoint="" apachepulsar/pulsar-manager sh -c "sed -i '/^default.environment.name/ s|.\*|default.environment.name=pulsar-standalone|' /pulsar-manager/pulsar-manager/application.properties & sed -i '/^default.environment.service\_url/ s|.\*|default.environment.service\_url=http://pulsar-standalone:8080|' /pulsar-manager/pulsar-manager/application.properties & /pulsar-manager/entrypoint.sh & tail -F /pulsar-manager/pulsar-manager/pulsar-manager.log"
- CSRF_TOKEN=$(curl http://localhost:7750/pulsar-manager/csrf-token)
- curl -H 'X-XSRF-TOKEN: $CSRF_TOKEN' -H 'Cookie: XSRF-TOKEN=$CSRF_TOKEN;' -H "Content-Type: application/json" -X PUT http://localhost:7750/pulsar-manager/users/superuser -d '{"name": "admin", "password": "apachepulsar", "description": "test", "email": "username@test.org"}'
复制代码 管理页面:http://192.168.100.103:9527/#/login?redirect=%2F
用户名:admin
密码:apachepulsar
4、zookeeper单机版安装
- mkdir -p /data/zookeeper/data/
- docker run -d --net macvlan --ip 192.168.100.104 --restart always -m 512M --name zookeeper -v /data/zookeeper/data/:/opt/zookeeper/data --privileged zookeeper
复制代码
5、单机版本Kafka
- docker run -d --net macvlan --ip 192.168.100.105 --restart always -m 512M --name kafka -e KAFKA_BROKER_ID=0 -e KAFKA_ZOOKEEPER_CONNECT=192.168.100.104:2181 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://192.168.100.105:9092 -e KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092 -e ALLOW_PLAINTEXT_LISTENER=yes bitnami/kafka
复制代码
6、Kafka UI页面- docker run -d --net macvlan --ip 192.168.100.106 --restart always -m 128M --name kafka-ui freakchicken/kafka-ui-lite
复制代码 管理页面:http://192.168.100.106:8889/#/
7、nacos- docker run -d --net macvlan --ip 192.168.100.107 --restart always -m 512M --name nacos-server --privileged=true -e JVM_XMS=256m -e JVM_XMX=256m -e MODE=standalone -e PREFER_HOST_MODE=nacoshost -v /opt/data/nacos/logs/:/home/nacos/logs -v /opt/data/nacos/data/:/home/nacos/data nacos/nacos-server
复制代码
管理页面:http://192.168.100.107:8848/nacos/
账户:nacos/nacos
8、sentinel
- docker run -d --net macvlan --ip 192.168.100.108 --restart always -m 256M --name sentinel bladex/sentinel-dashboard
复制代码
管理页面:http://192.168.100.108:8858/
账户:sentinel/sentinel |
|