服务开机自启

  • 查看自启动服务
    systemctl list-unit-files --type service |grep enabled
    systemctl list-unit-files --type service |grep service_name 查看单个服务
  • 设置开机启动/关闭
    (centos6系统)
    chkconfig --add service_name
    chkconfig --del service_name
    chkconfig service_name on
    chkconfig service_name off

    (centos7系统)
    systemctl enable service_name
    systemctl disable service_name

docker容器已经启动
docker update --restart=always <CONTAINER ID>

  • 示例:下面的命令启动一个Redis容器,当Redis容器停止后或者Docker被重启时,Redis容器都会重启。
    docker run -dit --restart unless-stopped redis

    docker run --restart=always --name tomcat -p 8080:8080 -d tomcat:7.0.106-jdk8-openjdk
FlagDescription
no不自动重启容器. (默认value)
on-failure容器发生error而退出(容器退出状态不为0)重启容器
unless-stopped在容器已经stop掉或Docker stoped/restarted的时候才重启容器
always在容器已经stop掉或Docker stoped/restarted的时候才重启容器

服务器安装Docker

安装Docker.
[Docker常用命令](https://www.runoob.com/docker/docker-command-manual.html).
官方安装

curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun

国内 daocloud 一键安装命令:

curl -sSL https://get.daocloud.io/docker | sh

配置阿里云镜像库

Docker下载镜像太慢,通过配置阿里云镜像库优化镜像下载速度

配置daemon.json

[root@localhost /]# cd /etc/docker/                             #切换到docker目录
[root@localhost docker]# ll
total 8                              #找到daemon.json文件,如果没有就新建一个
-rw-r--r--. 1 root root  76 Feb 23 16:23 daemon.json
-rw-------. 1 root root 244 Nov 20 09:16 key.json
[root@localhost docker]# 

打开daemon.json,内容配置如下

{
    "registry-mirrors":["https://almtd3fa.mirror.aliyuncs.com"]      
}

配置docker根目录地址

{
    "data-root": "/data/soft/docker_data"
}

重启docker,docker下载速度就可以起飞了

service docker restart

常用命令查询

docker logs -f -t --tail=10 tomcat-web
输出最后10条的实时日志,并打印当前日志时间

docker exec -it tomcat-web bash
进入容器中操作

【1】Nginx

docker-hub Nginx-tag.
拉取镜像

docker pull nginx:1.18.0

操作步骤:
1.创建一个 Nginx-test 测试容器,并将nginx.conf /conf.d/default.conf拷贝到主机
2.创建自定义目录, logs/conf/conf.d/html ,并将nginx.conf、default.conf拷贝到相应目录下
3.创建正式 Nginx-web 容器, 将自定义目录映射到相应目录启动;配置 --net=host,容器就和宿主机共用网络

docker run --name nginx-test -p 81:81 -d nginx:1.18.0
mkdir -p /data/nginx/conf
mkdir -p /data/nginx/conf.d
mkdir -p /data/nginx/logs
mkdir -p /data/nginx/html
docker cp nginx-test:/etc/nginx/nginx.conf /data/nginx/conf/nginx.conf
docker cp nginx-test:/etc/nginx/conf.d/default.conf /data/nginx/conf.d/default.conf
docker cp nginx-test:/usr/share/nginx/html /data/nginx

运行容器

docker run --name nginx-web -d -p 80:80 --net=host \
-v /data/nginx/html:/usr/share/nginx/html \
-v /data/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /data/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf  \
-v /data/nginx/logs:/var/log/nginx nginx:1.18.0
参数使用方式
–name声明容器名
–net=hostDocker的四种网络模式.
-p容器映射到宿主机的端口
-d后台运行容器,并返回容器ID
纠错排查

出现 403 Forbidden
如果在/usr/share/nginx/html下面没有index.html,直接访问域名,找不到文件,会报403 forbidden
因此需要在/usr/share/nginx/html目录下存在index.html文件(对本次配置,对应于宿主机上 /data/nginx/html目录下存在index.html文件)

【2】Tomcat

docker-hub Tomcat-tag.
拉取镜像

使用 tomcat:7.0.106 时,会有几率造成用户访问,偶尔出现 400 - 错误的请求
类型 状态报告
描述 由于被认为是客户端对错误(例如:畸形的请求语法、无效的请求信息帧或者虚拟的请求路由),服务器无法或不会处理当前请求。

如果使用 tomcat7,推荐使用 tomcat:7.0.104

docker pull tomcat:7.0.104-jdk8

docker 创建容器目录结构 /usr/local/tomcat
操作步骤:> 推荐使用方法二@
方法一:
1.创建tomcat容器
2.将本地项目及数据目录拷贝到容器中
3.将server.xml中运行的Tomcat 拷贝到主机上,进行配置
4.将修改后的server.xml再拷贝覆盖到容器中
5.重启启动tomcat容器

docker run --name tomcat -p 8080:8080 -d tomcat:7.0.104-jdk8
docker ps -a    #查看Tomcat容器信息 - CONTAINER ID
docker cp /project   容器ID:/project
docker cp 容器ID:/usr/local/tomcat/conf/server.xml /conf
docker restart tomcat

方法二:
1.创建测试tomcat-test容器
2.创建tomcat配置及日志目录 /data/tomcat/conf、/data/tomcat/logs
3.将容器中server.xml 拷贝到主机tomcat配置目录
4.创建正式tomcat容器,将项目路径、server.xml文件、tomcat日志路径映射到容器目录

docker run --name tomcat-test -p 8081:8081 -d tomcat:7.0.104-jdk8
mkdir -p /data/tomcat/conf
mkdir -p /data/tomcat/logs

docker ps -a #查看Tomcat容器信息 - CONTAINER ID

docker cp 容器ID:/usr/local/tomcat/conf/server.xml /data/tomcat/conf

运行容器

docker run --name tomcat-web --net=host -p 8080:8080 -v /rhhz:/rhhz \
-v /data/tomcat/conf/server.xml:/usr/local/tomcat/conf/server.xml \
-v /data/tomcat/logs:/usr/local/tomcat/logs -d tomcat:7.0.104-jdk8

1.网站访问报错400

排错处理:
1.如果使用新版本、高版本的Tomcat,可是尝试降低版本

docker pull tomcat:7.0.100-jdk8

【3】MySQL

mysql客户端备份

#!/bin/sh
#descripion: 数据库备份脚本

echo "启动备份任务..."
#修改配置参数
#生成的时间
date=`date +%Y%m%d%H%M%S`
dbUser=mysql
dbPwd=mysql
#备份服务器的登录IP、账户以及备份路径信息
scpServerInfo=/data/mysql/bak/

#!!!!前方高能 实施同事需要注意修改的地方如下,其他地方基本不用动 !!!!
#数据库集合 如果有多个数据库用空格分开
dbNames=(database_test)

#进入备份循环体
for dbName in ${dbNames[@]}
do
        echo "开始备份数据库:${dbName}"
        #数据库备份名称
        bakDBName=${dbName}_${date}.sql.gz
        #执行备份命令
        /usr/bin/mysqldump -u${dbUser} -p${dbPwd} ${dbName}|gzip > /data/mysql/bak/${bakDBName}
        echo "备份数据库完成。"
        #远程拷贝
        echo "开始异地备份拷贝文件:${bakDBName}"

        #scp /data/kfb/bak/mysql/${bakDBName}  ${scpServerInfo}
        echo "异地备份拷贝文件完成。"
        echo ""
done
echo "备份任务执行完成!"

#仅保留近1周的sql备份文件
find /data/mysql/bak/ -name "*.sql.gz" -type f -mtime +90 -exec rm -f {} \;

mysql容器备份

# mysql 为安装mysql的docker
#!/bin/bash
docker_name=mysql-web

date=`date +%Y%m%d%H%M%S`
dbUser=mysql
dbPwd=mysql
#备份服务器的登录IP、账户以及备份路径信息
#scpServerInfo=root@172.17.162.192:/data/kfb/bak/mysql/

#!!!!前方高能 实施同事需要注意修改的地方如下,其他地方基本不用动 !!!!
#数据库集合 如果有多个数据库用空格分开
dbNames=(database_test)
data_dir="/data/mysql/bak/"

#进入备份循环体
for dbName in ${dbNames[@]}
do
        echo "开始备份数据库:${dbName}"
        #数据库备份名称
        bakDBName=${dbName}_${date}.sql
 		#执行备份命令
        #/usr/bin/mysqldump -u${dbUser} -p${dbPwd} ${dbName}|gzip > /home/data/mysql/sql/${bakDBName}

		docker exec -it $docker_name mysqldump -u${dbUser} -p${dbPwd} ${dbName} > ${data_dir}${bakDBName}

        echo "备份数据库完成。"
        #远程拷贝
        #echo "开始异地备份拷贝文件:${bakDBName}"

        #scp /data/kfb/bak/mysql/${bakDBName}  ${scpServerInfo}
        #echo "异地备份拷贝文件完成。"
        echo ""
done
echo "备份任务执行完成!"



# 删除7天以前的备份
find ${data_dir} -name "*.sql" -type f -mtime +7 -exec rm -f {} \;

安装MySQL 5.6/5.7

docker-hub MySQL-tag.
拉取镜像

mysql修改字段需要在容器中修改,容器外可能不生效
安装MySQL 5.6

5.6和5.7配置文件目录结构不一样

docker pull mysql:5.6.48

操作步骤:
1.创建一个 mysql-test 测试容器,端口指向3307运行起来
2.进入容器,将 /etc/mysql/conf.d/mysqld.cnf 拷贝至主机,并进行修改配置
3.创建正式 mysql-web 容器, 将配置文件、数据目录映射到对应的目录下病启动;配置 --net=host,容器就和宿主机共用网络

docker run --name mysql-test --net=host -p 3307:3307 -e MYSQL_ROOT_PASSWORD=12345 -d mysql:5.6.48
mkdir -p /data/mysql/conf
mkdir -p /data/mysql/data
mkdir -p /data/mysql/log
mkdir -p /data/mysql/bak

docker ps -a #查看MySQL容器信息 - CONTAINER ID

docker cp mysql-test:/etc/mysql/mysql.conf.d/mysqld.cnf  /data/mysql/conf/mysqld.cnf

运行容器

docker run --name mysql-web --net=host -p 3306:3306 \
-v /data/mysql/conf/mysqld.cnf:/etc/mysql/mysql.conf.d/mysqld.cnf \
-v /data/mysql/data:/var/lib/mysql \
-v /data/mysql/log:/var/log/mysql \
-e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.6.48

主机安装MySQL-Clinet
MySQL-Clinet.

Red Hat Enterprise Linux / Oracle Linux
rpm文件是Red Hat公司开发的软件安装包,rpm可让Linux在安装软件包时免除许多复杂的手续。
mysql-community-common-5.7.22-1.el7.x86_64.rpm.
mysql-community-libs-5.7.22-1.el7.x86_64.rpm.
mysql-community-client-5.7.22-1.el7.x86_64.rpm.

rpm -qa | grep -i mariadb
rpm -qa | grep -i mysql

查看之前是否安装过mysql
[root@hadoop01 mysql]# rpm -qa | grep -i mysql
mysql-libs-5.1.71-1.el6.x86_64

rpm -qa | grep mariadb| xargs rpm -e --nodeps

rpm -qa | grep mysql | xargs rpm -e --nodeps
rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64

安装client
rpm命令在安装时常用的参数是–ivh,其中i表示将安装指定的rmp软件包,V表示安装时的详细信息,h表示在安装期间出现“#”符号来显示目前的安装过程。这个符号将持续到安装完成后才停止。

wget -c https://downloads.mysql.com/archives/get/p/23/file/mysql-community-common-5.7.22-1.el7.x86_64.rpm
wget -c https://cdn.mysql.com/archives/mysql-5.7/mysql-community-libs-5.7.22-1.el7.x86_64.rpm
wget -c https://cdn.mysql.com/archives/mysql-5.7/mysql-community-client-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-common-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.22-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.22-1.el7.x86_64.rpm

Directory Contents of Directory
/usr/bin Client programs and scripts
/usr/sbin The mysqld server
/var/lib/mysql Log files, databases
/usr/share/info MySQL manual in Info format
/usr/share/man Unix manual pages
/usr/include/mysql Include (header) files
/usr/lib/mysql Libraries
/usr/share/mysql Miscellaneous support files, including error messages, character set files, sample configuration files, SQL for database installation
/usr/share/sql-bench Benchmarks



docker pull mysql:5.7.26
docker run --name mysql-test --net=host -p 3307:3307 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7.26
mkdir -p /data/mysql/conf
mkdir -p /data/mysql/data
mkdir -p /data/mysql/bak

docker ps -a #查看MySQL容器信息 - CONTAINER ID

docker cp mysql-test:/etc/mysql/my.cnf  /data/mysql/conf/my.cnf

运行容器

docker run --name mysql-web --net=host -p 3306:3306 \
-v /data/mysql/conf/my.cnf:/etc/mysql/my.cnf \
-v /data/mysql/data:/var/lib/mysql \
-v /data/mysql/log:/var/log/mysql -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7.26
[root@server1 conf]# vim /data/mysql/conf/my.cnf
# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

#
# The MySQL Community Server configuration file.
#
# For explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html

[client]
port		= 3306
socket		= /var/run/mysqld/mysqld.sock

[mysqld_safe]
pid-file	= /var/run/mysqld/mysqld.pid
socket		= /var/run/mysqld/mysqld.sock
nice		= 0

[mysqld]
skip-host-cache
skip-name-resolve
user		= mysql
pid-file	= /var/run/mysqld/mysqld.pid
socket		= /var/run/mysqld/mysqld.sock
port		= 3306
basedir		= /usr
datadir		= /var/lib/mysql
tmpdir		= /tmp
lc-messages-dir	= /usr/share/mysql
explicit_defaults_for_timestamp

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address	= 127.0.0.1

#log-error	= /var/log/mysql/error.log

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

# * IMPORTANT: Additional settings that can override those from this file!
#   The files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/

删除创建的test版本

docker rm -f nginx-test
docker rm -f tomcat-test
docker rm -f mysql-test
参数说明
-d后台运行容器,并返回容器ID
–name “nginx-lb”为容器指定一个名称
-p 3306:3306映射容器服务的 3306 端口到宿主机的 3306 端口,外部主机可以直接通过 宿主机ip:3306 访问到 MySQL 的服务
-e username=“ritchie”设置环境变量
-e MYSQL_ROOT_PASSWORD设置 MySQL 服务 root 用户的密码

【4】Redis

创建配置文件目录存放redis.conf,文件从官网下载

docker pull redis:4.0.9
docker run --name redis-web --net=host -p 6379:6379 -v /usr/local/docker/redis.conf:/etc/redis/redis.conf -v /usr/local/docker/data:/data -d redis:4.0.9 --requirepass "liwenjie" --appendonly yes

参数说明:

-d redis 表示后台启动redis

-p 6379:6379 端口映射:前表示主机部分,:后表示容器部分。

–name myredis 指定该容器名称,查看和进行操作都比较方便。

-v 挂载目录,规则与端口映射相同。

为什么需要挂载目录:个人认为docker是个沙箱隔离级别的容器,这个是它的特点及安全机制,不能随便访问外部(主机)资源目录,所以需要这个挂载目录机制。

redis-server /etc/redis/redis.conf 以配置文件启动redis,加载容器内的conf文件,最终找到的是挂载的目录/usr/local/docker/redis.conf

–appendonly yes 开启redis 持久化

【5】Oracle

docker pull registry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle:19c
docker run --name oracle \
-p 1521:1521 -p 5500:5500 \
-e ORACLE_SID=orcl \
-e ORACLE_PDB=orclpdb1 \
-e ORACLE_PWD=123456 \
-e ORACLE_CHARACTERSET=zhs16gbk \
-e ORACLE_BASE=/opt/oracle \
-e ORACLE_HOME=/opt/oracle/product/19c/dbhome_1 \
-e PATH=/opt/oracle/product/19c/dbhome_1/bin:/opt/oracle/product/19c/dbhome_1/OPatch/:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
-v /data/web-data/soft/oracle/oradata:/opt/oracle/oradata \
registry.cn-hangzhou.aliyuncs.com/zhuyijun/oracle:19c

windows下启动容器命令

docker run --name myoracle `             
-p 1521:1521 -p 5500:5500 `
-e ORACLE_SID=orcl `
-e ORACLE_PDB=orclpdb1 `
-e ORACLE_PWD=123456 `
-e ORACLE_CHARACTERSET=zhs16gbk `
-e ORACLE_BASE=/opt/oracle `
-e ORACLE_HOME=/opt/oracle/product/19c/dbhome_1 `
-e PATH=/opt/oracle/product/19c/dbhome_1/bin:/opt/oracle/product/19c/dbhome_1/OPatch/:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin `
-v /d/docker/data/oradata:/opt/oracle/oradata `
<container name>
#创立文件 
mkdir -p /mydata/oracle/oradata
#受权,不受权会招致前面装置掉败 
chmod 777 /mydata/oracle/oradata

一、注意使用以前请修改启动参数 数据库
二、修改/home/nicemoe/oradata为本身建立的orcale数据存储目录vim
三、/d/docker/data/oradata为windows下文件路径,D:/docker/data/oradatawindows
四、请填写镜像的容器id或者容器名bash

修改Oralce数据库密码

docker exec  myoracle ./setPassword.sh 123456

【6】Seata

参考文档
华为云开发者联盟参考文档

docker run --name seata-server \
        -d -p 8091:8091 \
        -p 7091:7091 \
        -v ~/seata/config/resources/application.yml:/usr/local/docker/seata-server/resources/application.yml  \
        -v ~/seata/sessionStore:/usr/local/docker/seata-server/sessionStore \
        seataio/seata-server:1.5.0

docker run --name seata-server -d \
	-p 8091:8091 \
	-p 7091:7091 \
	-v /usr/local/docker/seata/registry.conf:/seata-server/resources/registry.conf \
	-v /usr/local/docker/seata/file.conf:/seata-server/resources/file.conf \
	-e SEATA_IP=192.168.11.136 \
seataio/seata-server

参数说明
-d后台运行容器,并返回容器ID
–name “seata-server”为容器指定一个名称
-p 8091:8091映射容器服务的 8091端口到宿主机的 8091端口,外部主机可以直接通过 宿主机ip:8091访问到 Seata服务
-v ~/seata/sessionStore:/usr/local/docker/seata-server/sessionStore容器目录映射到本地目录

1、拉取seata镜像

docker pull seataio/seata-server

2、创建seata本地目录

mkdir /usr/local/docker/seata/
cd /usr/local/docker/seata/

3、复制容器数据卷

docker run -d --name seata-server -p 8091:8091 seataio/seata-server
#启动后复制容器数据卷到刚创建的工作目录下
docker cp seata-server:/seata-server /usr/local/docker/seata/

4、清除停止旧容器

#停止旧容器
docker stop seata-server
#删除旧容器
docker rm -f seata-server

5、修改数据库配置和nacos的配置

1、备份复制配置文件

#进入配置文件所在的目录下
cd /usr/local/docker/seata/seata-server/resources
#备份原始的application.yml
\cp -r application.yml application.back_yml
#删除原始的application.yml
rm -rf application.yml
#重新复制模板文件application.example.yml为application.yml
\cp -r application.example.yml application.yml

2、修改配置文件

server:
  port: 7091
spring:
  application:
    name: seata-server
logging:
  config: classpath:logback-spring.xml
  file:
    path: ${user.home}/logs/seata
  extend:
    logstash-appender:
      destination: 127.0.0.1:4560
    kafka-appender:
      bootstrap-servers: 127.0.0.1:9092
      topic: logback_to_logstash
seata:
  config:
    # support: nacos 、 consul 、 apollo 、 zk  、 etcd3
    type: nacos
    nacos:
      server-addr: 192.168.11.136:8848
      namespace:
      group: SEATA_GROUP
      username: "nacos"
      password: "nacos"
      context-path:
      ##if use MSE Nacos with auth, mutex with username/password attribute
      #access-key:
      #secret-key:
      data-id: seataServer.properties
    consul:
      server-addr: 127.0.0.1:8500
      acl-token:
      key: seata.properties
    apollo:
      appId: seata-server
      apollo-meta: http://192.168.1.204:8801
      apollo-config-service: http://192.168.1.204:8080
      namespace: application
      apollo-access-key-secret:
      cluster: seata
    zk:
      server-addr: 127.0.0.1:2181
      session-timeout: 6000
      connect-timeout: 2000
      username:
      password:
      node-path: /seata/seata.properties
    etcd3:
      server-addr: http://localhost:2379
      key: seata.properties
  registry:
    # support: nacos 、 eureka 、 redis 、 zk  、 consul 、 etcd3 、 sofa
    type: nacos
    preferred-networks: 30.240.*
    nacos:
      application: seata-server
      server-addr: 192.168.11.136:8848
      group: SEATA_GROUP
      namespace:
      cluster: default
      username: "nacos"
      password: "nacos"
      context-path:
      ##if use MSE Nacos with auth, mutex with username/password attribute
      #access-key:
      #secret-key:
    eureka:
      service-url: http://localhost:8761/eureka
      application: default
      weight: 1
    redis:
      server-addr: localhost:6379
      db: 0
      password:
      cluster: default
      timeout: 0
    zk:
      cluster: default
      server-addr: 127.0.0.1:2181
      session-timeout: 6000
      connect-timeout: 2000
      username:
      password:
    consul:
      cluster: default
      server-addr: 127.0.0.1:8500
      acl-token:
    etcd3:
      cluster: default
      server-addr: http://localhost:2379
    sofa:
      server-addr: 127.0.0.1:9603
      application: default
      region: DEFAULT_ZONE
      datacenter: DefaultDataCenter
      cluster: default
      group: SEATA_GROUP
      address-wait-time: 3000

  server:
    service-port: 8091 #If not configured, the default is '${server.port} + 1000'
    max-commit-retry-timeout: -1
    max-rollback-retry-timeout: -1
    rollback-retry-timeout-unlock-enable: false
    enable-check-auth: true
    enable-parallel-request-handle: true
    retry-dead-threshold: 130000
    xaer-nota-retry-timeout: 60000
    enableParallelRequestHandle: true
    recovery:
      committing-retry-period: 1000
      async-committing-retry-period: 1000
      rollbacking-retry-period: 1000
      timeout-retry-period: 1000
    undo:
      log-save-days: 7
      log-delete-period: 86400000
    session:
      branch-async-queue-size: 5000 #branch async remove queue size
      enable-branch-async-remove: false #enable to asynchronous remove branchSession
  store:
    # support: file 、 db 、 redis
    mode: db
    session:
      mode: file
    lock:
      mode: file
    file:
      dir: sessionStore
      max-branch-session-size: 16384
      max-global-session-size: 512
      file-write-buffer-cache-size: 16384
      session-reload-read-size: 100
      flush-disk-mode: async
    db:
      datasource: druid
      db-type: mysql
      driver-class-name: com.mysql.jdbc.Driver
      url: jdbc:mysql://192.168.11.136:3306/seata?rewriteBatchedStatements=true
      user: root
      password: 123456
      min-conn: 10
      max-conn: 100
      global-table: global_table
      branch-table: branch_table
      lock-table: lock_table
      distributed-lock-table: distributed_lock
      query-limit: 1000
      max-wait: 5000
    redis:
      mode: single
      # support: lua 、 pipeline
      type: lua
      database: 0
      min-conn: 10
      max-conn: 100
      password:
      max-total: 100
      query-limit: 1000
      single:
        host: 127.0.0.1
        port: 6379
      sentinel:
        master-name:
        sentinel-hosts:
  metrics:
    enabled: false
    registry-type: compact
    exporter-list: prometheus
    exporter-prometheus-port: 9898
  transport:
    rpc-tc-request-timeout: 15000
    enable-tc-server-batch-send-response: false
    shutdown:
      wait: 3
    thread-factory:
      boss-thread-prefix: NettyBoss
      worker-thread-prefix: NettyServerNIOWorker
      boss-thread-size: 1

3准备seata的数据库表(用于上面配置db事务数据库做准备)
。。。。。。。。。。。

访问seata控制台
http://localhost:7091
输入账号密码:seata/seata
在这里插入图片描述

【7】Nacos

参考文档

docker pull nacos/nacos-server
docker run -d --name nacos \
--ip 0.0.0.0 \
-p 8848:8848 \
-p 9848:9848 \
-p 9849:9849 \
--env MODE=standalone \
--env NACOS_AUTH_ENABLE=true \
-v /www/wwwroot/changjing/docker/nacos/conf/:/home/nacos/conf \
-v /www/wwwroot/changjing/docker/nacos/logs:/home/nacos/logs \
-v /www/wwwroot/changjing/docker/nacos/data:/home/nacos/data \
nacos/nacos-server:v2.2.1

错误处理

1.Docker容器做端口映射报错

Docker容器做端口映射报错
docker: Error response from daemon: driver failed programming external connectivity on endpoint lamp3 (46b7917c940f7358948e55ec2df69a4dec2c6c7071b002bd374e8dbf0d40022c): (iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 86 -j DNAT --to-destination 172.17.0.2:80 ! -i docker0: iptables: No chain/target/match by that name.
解决方法
docker服务启动时定义的自定义链DOCKER被清除
重启即可systemctl restart docker
Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐