seata Adjusted frame length exceeds 8388608: 539959368,nacos+mysql+seata部署

问题:docker 部署 seata 后出现异常

        seata Adjusted frame length exceeds 8388608: 539959368

        CSDN上找了一圈都解决不了。github又半天访问不上。后来终于访问上了,发现这是一个很离谱的问题。。。

原因:访问错了端口

        seata默认分两个端口8091,7091,7091是网页访问的端口,8091是seata服务的端口,如果用网页访问,因为不支持http,所以会报这个错误

seata:部署步骤

        1、启动一个容器
docker run -d --name seata seataio/seata-server
        2、拷贝文件到外部方便修改
docker cp seata:/seata-server /usr/local/docker/seata/ 
        3、删除旧容器
docker stop seata
docker rm seata
        4、搭建好自己的mysql,nacos(这里就不详细说了)
        5、mysql 创建seata数据库,运行数据库脚本

CREATE TABLE IF NOT EXISTS `global_table`
(
    `xid`                       VARCHAR(128) NOT NULL,
    `transaction_id`            BIGINT,
    `status`                    TINYINT      NOT NULL,
    `application_id`            VARCHAR(32),
    `transaction_service_group` VARCHAR(32),
    `transaction_name`          VARCHAR(128),
    `timeout`                   INT,
    `begin_time`                BIGINT,
    `application_data`          VARCHAR(2000),
    `gmt_create`                DATETIME,
    `gmt_modified`              DATETIME,
    PRIMARY KEY (`xid`),
    KEY `idx_gmt_modified_status` (`gmt_modified`, `status`),
    KEY `idx_transaction_id` (`transaction_id`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8;
 
-- the table to store BranchSession data
CREATE TABLE IF NOT EXISTS `branch_table`
(
    `branch_id`         BIGINT       NOT NULL,
    `xid`               VARCHAR(128) NOT NULL,
    `transaction_id`    BIGINT,
    `resource_group_id` VARCHAR(32),
    `resource_id`       VARCHAR(256),
    `branch_type`       VARCHAR(8),
    `status`            TINYINT,
    `client_id`         VARCHAR(64),
    `application_data`  VARCHAR(2000),
    `gmt_create`        DATETIME(6),
    `gmt_modified`      DATETIME(6),
    PRIMARY KEY (`branch_id`),
    KEY `idx_xid` (`xid`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8;
 
-- the table to store lock data
CREATE TABLE IF NOT EXISTS `lock_table`
(
    `row_key`        VARCHAR(128) NOT NULL,
    `xid`            VARCHAR(96),
    `transaction_id` BIGINT,
    `branch_id`      BIGINT       NOT NULL,
    `resource_id`    VARCHAR(256),
    `table_name`     VARCHAR(32),
    `pk`             VARCHAR(36),
    `gmt_create`     DATETIME,
    `gmt_modified`   DATETIME,
    PRIMARY KEY (`row_key`),
    KEY `idx_branch_id` (`branch_id`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8;


CREATE TABLE IF NOT EXISTS `global_table`
(
    `xid`                       VARCHAR(128) NOT NULL,
    `transaction_id`            BIGINT,
    `status`                    TINYINT      NOT NULL,
    `application_id`            VARCHAR(32),
    `transaction_service_group` VARCHAR(32),
    `transaction_name`          VARCHAR(128),
    `timeout`                   INT,
    `begin_time`                BIGINT,
    `application_data`          VARCHAR(2000),
    `gmt_create`                DATETIME,
    `gmt_modified`              DATETIME,
    PRIMARY KEY (`xid`),
    KEY `idx_gmt_modified_status` (`gmt_modified`, `status`),
    KEY `idx_transaction_id` (`transaction_id`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8;
 
-- the table to store BranchSession data
CREATE TABLE IF NOT EXISTS `branch_table`
(
    `branch_id`         BIGINT       NOT NULL,
    `xid`               VARCHAR(128) NOT NULL,
    `transaction_id`    BIGINT,
    `resource_group_id` VARCHAR(32),
    `resource_id`       VARCHAR(256),
    `branch_type`       VARCHAR(8),
    `status`            TINYINT,
    `client_id`         VARCHAR(64),
    `application_data`  VARCHAR(2000),
    `gmt_create`        DATETIME(6),
    `gmt_modified`      DATETIME(6),
    PRIMARY KEY (`branch_id`),
    KEY `idx_xid` (`xid`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8;
 
-- the table to store lock data
CREATE TABLE IF NOT EXISTS `lock_table`
(
    `row_key`        VARCHAR(128) NOT NULL,
    `xid`            VARCHAR(96),
    `transaction_id` BIGINT,
    `branch_id`      BIGINT       NOT NULL,
    `resource_id`    VARCHAR(256),
    `table_name`     VARCHAR(32),
    `pk`             VARCHAR(36),
    `gmt_create`     DATETIME,
    `gmt_modified`   DATETIME,
    PRIMARY KEY (`row_key`),
    KEY `idx_branch_id` (`branch_id`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8;

        6、进入/usr/local/docker/seata/ 目录修改seata-server,拷贝application.example.yml为application.yml
cp application.example.yml application.yml
        7、修改application.yml , seata.config

seata:
  config:
    # support: nacos 、 consul 、 apollo 、 zk  、 etcd3
    type: nacos
    nacos:
      server-addr: #你的nacos地址(默认为127.0.0.1:8848)
      namespace:
      group: SEATA_GROUP
      context-path:
      ##1.The following configuration is for the open source version of Nacos
      username: #你的nacos用户名(默认为nacos)
      password: #你的nacos密码(默认为nacos)

      ##2.The following configuration is for the MSE Nacos on aliyun
      #access-key:
      #secret-key:
      ##3.The following configuration is used to deploy on Aliyun ECS or ACK without authentication
      #ram-role-name:
      data-id: seataServer.properties
 

        8、修改application.yml , seata.registry

registry:

    # support: nacos 、 eureka 、 redis 、 zk  、 consul 、 etcd3 、 sofa

    type: nacos

    preferred-networks: 30.240.*

    nacos:

      application: seata-server

      server-addr: #你的nacos地址(默认为127.0.0.1:8848

      group: SEATA_GROUP

      namespace:

      cluster: default

      context-path:

      ##1.The following configuration is for the open source version of Nacos

      username: #你的nacos用户名(默认为nacos)

      password: #你的nacos用户名(默认为nacos)

      ##2.The following configuration is for the MSE Nacos on aliyun

      #access-key:

      #secret-key:

      ##3.The following configuration is used to deploy on Aliyun ECS or ACK without authentication

      #ram-role-name:

          9、修改application.yml , store

store:

    # support: file 、 db 、 redis 、 raft

    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://IP:3306/seata?rewriteBatchedStatements=true

      user: #数据库用户

      password: #数据库密码

      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

10、application.yml 的最后加上store.security、console配置

  security:
    secretKey: "key"
    tokenValidityInMilliseconds: 1000000
console:
  user:
    username: #你想的用户名
    password: #你想一个密码

11、启动seata
docker run -d --restart always --name seata -p 8091:8091 -p 7091:7091 -v /usr/local/docker/seata/seata-server/:/seata-server -e SEATA_PORT=8091 seataio/seata-server
12、访问seata

http://IP:7091

seata Adjusted frame length exceeds 8388608: 539959368,nacos+mysql+seata部署_第1张图片

你可能感兴趣的:(eureka,云原生)