pigx部署文档

pigx入门-详细部署

环境说明安装

  • 相关下载:https://www.aliyundrive.com/s/3h6N2kh5yvV

image-20220301103333991

项目下载

# 下载源代码
git clone https://git.pig4cloud.com/pig/pigx.git
  • 关于系统账号密码说明

image-20220301103537824

依次运行sql文件

导入除了DockerFile和Update.sql全部导入数据库

image-20220511163043295

image-20220511163800339

配置本地host

  • win配置方法:https://www.jb51.net/os/win10/395409.html
127.0.0.1 pigx-register
127.0.0.1 pigx-gateway
127.0.0.1 pigx-redis
127.0.0.1 pigx-xxl
127.0.0.1 pigx-mysql
127.0.0.1 pigx-sentinel
127.0.0.1 pigx-monitor

启动redis

image-20220301104110482

打开配置文件修改数据库密码

运行pigx项目

  • 启动相关服务
    • PigxNacosApplication :8848/
    • PigxGatewayApplication :9999/
    • PigxAuthApplication :3000/
    • PigxAdminApplication :4000/
    • PigxCodeGenApplication :5003/

    image-20220301104307386

  • 启动前端
    • 检查node版本

      检查node版本 = 14

      node -v

      若高版本node 可执行n 命令切换至 14版本

      n 14.18.1

    • 输入命令启动 npm run dev

    • 浏览器访问: http://localhost:8080

      默认用户名: admin

      默认密码: 123456

    image-20220301104529369

生成子项目

  • 打开cmd编译pigx项目
cd pigx/
mvn clean install
  • cmd运行,生成子项目()
mvn archetype:generate ^
       -DgroupId=com.pig4cloud ^
       -DartifactId=pigx-ceshi ^
       -Dversion=4.2.0 ^
       -Dpackage=com.pig4cloud.pigx.ceshi ^
       -DarchetypeGroupId=com.pig4cloud.archetype ^
       -DarchetypeArtifactId=pigx-gen ^
       -DarchetypeVersion=4.2.0 ^
       -DarchetypeCatalog=local
       

image-20220514161823941

  • 创建数据库表
-- 创建测试库
create database `pigxx_ceshi` default character set utf8mb4 collate utf8mb4_general_ci;

USE pigxx_ceshi;

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- 创建测试表
DROP TABLE IF EXISTS `test`;
CREATE TABLE `test` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
                      `username` varchar(255) DEFAULT NULL COMMENT '用户名',
                      `password` varchar(255) DEFAULT NULL COMMENT '密码',
                       PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='test 表';

  • 打开前端界面,新增数据源

image-20220301105058285

  • 数据源
jdbc:mysql://pigx-mysql:3306/pigxx_ceshi?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true

image-20220514161910590

image-20220301105218935

  • 代码生成

image-20220301105328428

image-20220301105354043

  • 把生成的代码复制到对应文件

    image-20220514162229749

  • 执行生成的sql脚本

image-20220301105910232

  • 配置动态路由

image-20220301110104785

在这里插入图片描述

  • 把权限放出来

image-20220301110221615
image-20220514162527064

  • 启动骨架模块项目
  • 实现pigxCRUD!
03-26
### PigX 框架概述 PigX 是一款基于 Spring Cloud 的微服务框架,旨在提供高效、稳定的企业级解决方案。它支持分布式事务处理、动态路由网关等功能,并提供了丰富的扩展能力[^1]。 #### 配置文件获取方式 可以通过 Git 工具克隆配置仓库来获得 PigX 框架的核心配置文件。具体命令如下所示: ```bash git clone https://gitee.com/cqzqxq_lxh/pig-config.git ``` 此操作会下载到 `pig-config` 文件夹中的所有必要配置文件。 #### 安装环境准备 为了使 PigX 正常运行,在本地环境中需设置特定的虚拟主机映射关系。通过编辑 `/etc/hosts` 或 Windows 系统下的 `%SystemRoot%\system32\drivers\etc\hosts` 文件实现域名解析绑定。以下是推荐的内容: ```plaintext 10.10.1.110 pig-mysql 10.10.1.110 pig-redis 10.10.1.110 pig-gateway 10.10.1.110 pig-register 10.10.1.110 pig-sentinel 10.10.1.110 pig-job ``` 上述 IP 地址和对应的子域名称用于模拟真实网络部署场景下各组件间的通信需求[^2]。 #### 示例代码展示 下面是一个简单的例子,展示了如何利用 PigX 中定义好的 Mapper 接口完成数据访问层的操作: ```java package com.mycompany.mydemo.customer.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; import com.mycompany.mydemo.customer.entity.CustomerEntity; import com.mycompany.mydemo.customer.mapper.CustomerMapper; @Service public class CustomerService { @Autowired private CustomerMapper customerMapper; public List<CustomerEntity> getAllCustomers() { return customerMapper.selectAll(); } } ``` 以上片段来源于官方文档实例讲解部分[^3]。 #### 文档资源链接 对于更详细的安装指南以及功能特性介绍,请参阅以下资料位置: - Gitee 开源项目主页:https://gitee.com/log4j/pigx - 官方博客文章系列:“【开源项目】一篇文章搞掂:Pig 微服务框架”
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值