docker启动各类中间件指令
安装redis:
docker run -p 6379:6379 -v /zzyyuse/myredis/data:/data -v /zzyyuse/myredis/conf/redis.conf:/usr/local/etc/redis/redis.conf -d redis:3.2 redis-server /usr/local/etc/redis/redis.conf --appendonly yes
安装elasticsearch:
docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms64m -Xmx512m" \
-v /mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /mydata/elasticsearch/data:/usr/share/elasticsearch/data \
-v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch:7.4.2
安装kibana:
docker run --name kibana -e ELASTICSEARCH_URL=http://47.104.248.219:9200 -p 5601:5601 \
-d kibana:7.4.2
安装nginx:
docker run -p 80:80 --name nginx \
-v /mydata/nginx/html:/usr/share/nginx/html \
-v /mydata/nginx/logs:/var/log/nginx \
-v /mydata/nginx/conf:/etc/nginx \
-d nginx:1.10
安装RabbitMQ:
docker pull rabbitmq
docker run --privileged=true -d --hostname my-rabbit --name rabbit -p 15672:15672 -p 5672:5672 rabbitmq:latest
docker ps -a // 查看运行的容器
docker exec -it xxxxxxx /bin/bash // 根据容器id进入容器内部
rabbitmq-plugins enable rabbitmq_management // 使能rabbitmq管理器
rabbitmqctl list_users // 列出所有的用户
rabbitmqctl change_password admin '1234567'
cd /etc/rabbitmq/conf.d/
echo management_agent.disable_metrics_collector = false > 20-management_agent.disable_metrics_collector.conf
docker restart rabbitmq
安装MySQL:
docker run -p 12345:3306 --name mysql -v /zzyyuse/mysql/conf:/etc/mysql/conf.d -v /zzyyuse/mysql/logs:/logs -v /zzyyuse/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.6