docker+mongodb+nginx+redis
systemctl start docker
redis-server /root/myredis/redis.conf
docker start mymongo
docker start rabbitmq
docker exec -it mymongo /bin/bash
0.Docker install redis
1.docker start
install docker
# 1.安装gcc和g++
yum -y install gcc
yum -y install gcc-c++
# 2. 安装需要的软件包
yum install -y yum-utils device-mapper-persistent-data lvm2
#3. 设置镜像仓库
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
#4. 更新yum软件包索引
yum makecache fast
#5. 安装DOCKER CE(社区版)(DOCKER EE企业版收费)
yum -y install docker-ce
#6. 启动docker
手动启动:systemctl start docker
自动启动:systemctl enable docker
# 7. 配置镜像加速CentOS7版本
mkdir -p /etc/docker
vim /etc/docker/daemon.json
#网易云
{
"registry-mirrors": ["http://hub-mirror.c.163.com"]
}
#阿里云(推荐)
{
"registry-mirrors": ["https://8y2y8njn.mirror.aliyuncs.com"]
}
启动docker: systemctl start docker
停止docker: systemctl stop docker
重启docker: systemctl restart docker
查看docker状态: systemctl status docker
开机启动: systemctl enable docker
查看docker概要信息 docker info
查看docker帮助文档 docker ‐‐help
2.docker install MongoDB
1. Installation
(1) Confirm docker service
systemctl start docker
(2) Download
docker pull mongo:latest
docker pull mongo:4.4.8
3) Create and start the container
docker run -d --restart=always -p 27017:27017 --name mymongo -v /data/db:/data/db -d mongo:4.4.8
(4) into the container
docker exec -it mymongo /bin/bash
mongo
3. Start nginx
Just double click
4. redis configuration + installation
1. Download:
Link: https://pan.baidu.com/s/1BnWy4wJWu1PLay1eJaQuuw?pwd=wvxh
Extraction code: wvxh
- Install the C locale
yum -y install gcc
- Test whether the installation was successful
gcc --version
The third step is to upload redis-6.2.1.tar.gz to the /opt directory
The fourth step decompression command: tar -zxvf redis-6.2.1.tar.gz
Step 5 Enter the directory after decompression is complete: cd redis-6.2.1
The sixth step is to execute the make command again in the redis-6.2.1 directory (just compiled)
The seventh step is to skip make test and continue to execute make install
4.1 Redis start and stop
1. View the installation directory
cd /usr/local/bin
2 Foreground startup method
redis-server
- Reason for not recommending: The window cannot be closed, and the service will stop when it is closed
4.2 Background startup method
- Create a myredis directory in the /root directory to store configuration files for startup
cd /root
mkdir myredis
- Copy a copy of redis.conf to the myredis directory
cp /opt/redis-6.2.1/redis.conf /root/myredis
- Modify the content in the configuration file daemonize no to yes
修改redis.conf(257行附近?或者搜索 ) 文件将里面的daemonize no 改成 yes,让服务在后台启动
- Modify the bind in the configuration file, comment the configuration, unbind only host login
- Modify protected-mode to no, cancel the protected mode
- When starting redis, use our modified configuration file
redis-server /root/myredis/redis.conf
- View service startup status
ps -ef | grep redis
5.rabbitmq
Pull image docker pull rabbitmq:management
#Create container start
docker run -d --restart=always -p 5672:5672 -p 15672:15672 --name rabbitmq rabbitmq:management