2020年的时候租用了一个腾讯云的服务器,在上面也没什么用,只是用docker跑了一个mysql,一个redis
#docker
yum install -y yum-utils device-mapper-persistent-data lvm
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum -y install docker-ce
systemctl enable docker
systemctl start docker
docker ps -a
docker stop <id>
docker restart <id>
docker start <id>
docker rm <id>
docker exec -it <id> /bin/bash
#mysql
docker pull mysql
#在/software/mysql目录下
docker run -p 3306:3306 --name mymysql -v $PWD/conf:/etc/mysql/conf.d -v $PWD/logs:/logs -v $PWD/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql
#在所有路径下
docker run -p 3306:3306 --name mymysql -v /software/mysql/conf:/etc/mysql/conf.d -v /software/mysql/logs:/logs -v /software/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql
mysql -uroot -p
GRANT ALL ON *.* TO 'root'@'%';
flush privileges;
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;
skip-grant-tables 后设置
update user set authentication_string='' where user='root'; 再重启
mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';
mysql> flush privileges;
#gitlab
docker pull gitlab/gitlab-ce
docker run -d -p 443:443 -p 80:80 -p 2222:22 --name gitlab --restart always -v /software/gitlab/config:/etc/gitlab -v /software/gitlab/logs:/var/log/gitlab -v /software/gitlab/data:/var/opt/gitlab gitlab/gitlab-ce
# -d:后台运行
# -p:将容器内部端口向外映射
# --name:命名容器名称
# -v:将容器内数据文件夹或者日志、配置等文件夹挂载到宿主机指定目录
#redis
docker pull redis
docker run -p 6379:6379 --name redis -v /software/redis/redis.conf:/etc/redis/redis.conf -v /software/redis/data:/data -dit redis /bin/bash
#进去启动redis
redis-server /etc/redis/redis.conf
#mycat
docker run -p 3301:3306 --name mysql1 -v /software/mysql1/conf:/etc/mysql/conf.d -v /software/mysql1/logs:/logs -v /software/mysql1/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql
docker run -p 3302:3306 --name mysql2 -v /software/mysql2/conf:/etc/mysql/conf.d -v /software/mysql2/logs:/logs -v /software/mysql2/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql
docker run -p 3303:3306 --name mysql3 -v /software/mysql3/conf:/etc/mysql/conf.d -v /software/mysql3/logs:/logs -v /software/mysql3/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql
docker run -p 3304:3306 --name mysql4 -v /software/mysql4/conf:/etc/mysql/conf.d -v /software/mysql4/logs:/logs -v /software/mysql4/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql