1.Xshell连接腾讯云,,输入账号密码,
a.先装docker,
1)推荐阿里云下载地址(推荐)
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
2)更新 yum 软件包索引
yum makecache fast
3)安装 DOCKER CE
yum install -y docker-ce docker-ce-cli containerd.io
4)启动 docker
systemctl start docker systemctl enable docker #设置开机自启动
2.装Docker Compose
yum install python3 yum install python3-pip pip3 install --upgrade pip pip3 install docker-compose
.将文件 docker-compose-env.yml 用Xshell上传至宿主机 /root/myfile 目录
docker-compose-env.yml 文件
具体代码:
version: '3' services: mysql: image: mysql:5.7 container_name: mysql command: mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci restart: always environment: MYSQL_ROOT_PASSWORD: root #设置root帐号密码 ports: - 3306:3306 zipkin: image: openzipkin/zipkin:latest container_name: zipkin restart: always ports: - "9411:9411" redis: image: redis container_name: redis command: redis-server --appendonly yes restart: always ports: - 6379:6379 rabbitmq: image: rabbitmq:management container_name: rabbitmq restart: always ports: - 5672:5672 - 15672:15672 elasticsearch: image: elasticsearch:6.8.1 container_name: elasticsearch restart: always environment: - "cluster.name=elasticsearch" #设置集群名称为elasticsearch - "discovery.type=single-node" #以单一节点模式启动 - "ES_JAVA_OPTS=-Xms512m -Xmx512m" #设置使用jvm内存大小 ports: - 9200:9200 kibana: image: kibana:6.8.1 container_name: kibana restart: always links: - elasticsearch:es #可以用es这个域名访问elasticsearch服务 depends_on: - elasticsearch #kibana在elasticsearch启动之后再启动 environment: - "elasticsearch.hosts=http://es:9200" #设置访问elasticsearch的地址 ports: - 5601:5601 tracker: image: morunchang/fastdfs container_name: tracker restart: always network_mode: "host" command: "sh tracker.sh" storage: image: morunchang/fastdfs container_name: storage restart: always depends_on: - tracker #storage在tracker启动之后再启动 environment: - "TRACKER_IP=http://tracker:22122" #设置访问tracker的地址 - "GROUP_NAME=group1" network_mode: "host" command: "sh storage.sh"
执行命令docker-compose -f -docker-compose.yml up -d
【没有的docker镜像在下面单独拉取:】
docker 启动zipkin
docker run -d --restart always -p 9411:9411 --name zipkin openzipkin/zipkin
docker 启动sentinel
docker run --name sentinel --restart=always -p 8858:8858 -d bladex/sentinel-dashboard
docker 启动nacos
docker run --name nacos-standalone --restart=always -e MODE=standalone -p 8848:8848 -d nacos/nacos-server:latest
docker 启动redis
docker run --name redis -p 6379:6379 --restart=always -d redis
mysql
docker run -p 3306:3306 --name mysql -e MYSQL_ROOT_PASSWORD=123456 --restart=always -d mysql:5.7
3.开放端口,在云服务器的防火墙中新建规则,开放端口
4.转储mysql的数据库文件,新建连接,新建数据库,对应运行转储的sql文件、
5.改项目的配置文件中的端口,resour---application.yml中的端口号
(6).如若用到hosts,在系统中改端口号
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)