Nacos + Seata2.2.0 版本Windows部署 + Docker部署

Windows部署

1. 配置seata所依赖的数据库

C:\Users\wangyifei\Desktop\工作\seata\seata-server\script\server\db

找到下载下来的seata压缩包并解压,打开script目录下的db

这里存放的是各个数据库支持的Seata,我用的MySQL,这个按照自己使用的数据库类型创建一个seata数据库,并执行sql文件就可以了,执行完毕结果如下:

每个Seata版本的数据库SQL文件都可能存在一些细微差距,根据自己下载的Seata版本去执行,建议完全跟我一样,用2.2.0的版本,这样可以完全一致。我

--
-- Licensed to the Apache Software Foundation (ASF) under one or more
-- contributor license agreements.  See the NOTICE file distributed with
-- this work for additional information regarding copyright ownership.
-- The ASF licenses this file to You under the Apache License, Version 2.0
-- (the "License"); you may not use this file except in compliance with
-- the License.  You may obtain a copy of the License at
--
--     http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
--

-- -------------------------------- The script used when storeMode is 'db' --------------------------------
-- the table to store GlobalSession data
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_status_gmt_modified` (`status` , `gmt_modified`),
    KEY `idx_transaction_id` (`transaction_id`)
) ENGINE = InnoDB
  DEFAULT CHARSET = utf8mb4;

-- 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 = utf8mb4;

-- the table to store lock data
CREATE TABLE IF NOT EXISTS `lock_table`
(
    `row_key`        VARCHAR(128) NOT NULL,
    `xid`            VARCHAR(128),
    `transaction_id` BIGINT,
    `branch_id`      BIGINT       NOT NULL,
    `resource_id`    VARCHAR(256),
    `table_name`     VARCHAR(32),
    `pk`             VARCHAR(36),
    `status`         TINYINT      NOT NULL DEFAULT '0' COMMENT '0:locked ,1:rollbacking',
    `gmt_create`     DATETIME,
    `gmt_modified`   DATETIME,
    PRIMARY KEY (`row_key`),
    KEY `idx_status` (
Spring Cloud Nacos是一种基于Nacos的微服务架构中的服务发现和配置管理工具。它提供了服务注册与发现、服务健康监测、动态配置管理等功能,可以帮助我们更好地管理前端Vue项目的上线部署。 首先,我们需要在前端Vue项目中引入Spring Cloud Nacos的相关依赖。可以通过Maven或者Gradle方式引入,具体的依赖可以参考Spring Cloud Nacos的官方文档。 接下来,在前端Vue项目的配置文件中,我们需要指定Nacos服务的地址和端口号。这样前端项目就可以通过Nacos注册和发现相关的微服务。配置文件的具体内容如下所示: ``` nacos: server-addr: localhost:8848 ``` 然后,我们需要在前端Vue项目中编写相应的代码来获取Nacos中的配置信息。可以使用Nacos提供的Java SDK或者相关的RESTful接口来实现。通过动态配置管理的功能,我们可以在Nacos中配置前端Vue项目的一些运行参数,并实时获取这些配置信息。 最后,我们需要将前端Vue项目打包,并将打包后的文件部署到服务器上。可以使用Nginx等Web服务器来托管前端静态资源文件。部署过程中需要注意配置Nginx来正确地映射前端Vue项目的访问路径。 总结来说,通过引入Spring Cloud Nacos的依赖,配置Nacos的地址和端口号,编写相关代码来获取Nacos中的配置信息,并将前端Vue项目打包部署到服务器上,我们就可以实现前端Vue项目的上线部署。这样可以更好地管理和配置前端项目,提高项目的可维护性和灵活性。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值