切换主题
🚀 快速开始
🔄 部署流程
📋 系统要求
硬件配置
配置项 | 最低要求 | 推荐配置 | 说明 |
---|---|---|---|
CPU | 64位 2核 | 64位 4核+ | 仅支持64位处理器 |
内存 | 2GB | 4GB+ | 建议预留50%空闲 |
磁盘 | 500MB | 20GB+ | 需考虑日志存储空间 |
软件环境
环境 | 版本要求 | 说明 |
---|---|---|
操作系统 | 64位 | Windows/Linux |
数据库 | MySQL 5.7+ 或 PostgreSQL 12.0+ | 支持两种数据库 |
Nacos | 2.0.0+ | 服务注册中心 |
📥 下载安装包
系统兼容性
仅支持64位操作系统,请根据您的系统架构选择对应的安装包
bash
# 下载Windows 64位安装包
wget https://software.wueasy.com/operation-log/latest/operation_log_win_64.zip
bash
# 下载Linux AMD64安装包
wget https://software.wueasy.com/operation-log/latest/operation_log_linux_amd64.zip
# 解压安装包
unzip operation_log_linux_amd64.zip -d /srv/operation-log
bash
# 下载Linux ARM64安装包
wget https://software.wueasy.com/operation-log/latest/operation_log_linux_arm64.zip
# 解压安装包
unzip operation_log_linux_arm64.zip -d /srv/operation-log
修改配置
配置文件在
config.yaml
中
配置位置
配置文件路径:config.yaml
,包含服务运行的所有必要配置
yaml
# 服务基础配置
server:
port: 9810 # 服务监听端口
name: wueasy-operation-log # 应用名称
# Nacos服务注册配置
nacos:
enabled: true # 是否启用服务注册
server-addr: nacos.lb.wueasy.cn:8848 # Nacos服务器地址,多个用逗号分隔
username: example # Nacos用户名
password: example # Nacos密码
group: dev # 服务分组
namespace: dev # 命名空间
#ip: 192.168.3.54 # 可选:指定服务IP
#port: 9720 # 可选:指定服务端口
# 数据库连接配置
db:
# 数据库类型和连接配置
driver-name: postgres # 数据库类型:mysql/postgres
# PostgreSQL连接示例
uri: postgres://用户名:密码@主机:5432/数据库名?sslmode=disable
# MySQL连接示例(二选一)
#uri: 用户名:密码@tcp(主机:3306)/数据库名?charset=utf8mb4&parseTime=True&loc=Asia%2fShanghai
# 连接池优化配置
max-open-conns: 200 # 最大连接数
max-idle-conns: 10 # 最大空闲连接数
⚙️ 配置文件说明
数据库连接说明
PostgreSQL 连接参数
参数 | 说明 | 示例 |
---|---|---|
用户名 | 数据库用户名 | postgres |
密码 | 数据库密码 | password |
主机 | 数据库服务器地址 | localhost |
端口 | 数据库端口 | 5432 |
sslmode | SSL连接模式 | disable |
MySQL 连接参数
参数 | 说明 | 示例 |
---|---|---|
charset | 字符集 | utf8mb4 |
parseTime | 时间解析 | True |
loc | 时区设置 | Asia/Shanghai |
📦 部署安装
Linux 环境部署
bash
# 1. 创建部署目录
mkdir -p /srv/operation-log
# 2. 复制安装文件
cp operation_log_linux_amd64 config.yaml /srv/operation-log/
# 3. 设置文件权限
cd /srv/operation-log
chmod u+x operation_log_linux_amd64
chmod 600 config.yaml
# 4. 创建服务用户(可选)
useradd -r -s /sbin/nologin operation-log
chown -R operation-log:operation-log /srv/operation-log
# 5. 安装服务
./operation_log_linux_amd64 install
# 6. 启动服务
./operation_log_linux_amd64 start
✅ 部署验证
1. 服务状态检查
bash
# Linux 环境
systemctl status operation-log
./operation_log_linux_amd64 status
2. 日志检查
bash
# 查看启动日志
tail -f /var/log/operation-log/operation-log.log
# 查看错误日志
tail -f /var/log/operation-log/error.log
3. 端口检查
bash
# 检查端口占用
netstat -tunlp | grep 9810
4. Nacos服务检查
- 登录 Nacos 控制台
- 检查服务注册状态
- 验证服务健康状态
🔧 故障排查
常见问题
服务无法启动
- 检查端口占用
- 验证配置文件格式
- 确认数据库连接
- 查看错误日志
数据库连接失败
- 验证数据库凭证
- 检查网络连接
- 确认数据库服务状态
Nacos注册失败
- 检查Nacos服务地址
- 验证认证信息
- 确认网络连通性
注意事项
- 定期备份配置文件
- 监控服务运行状态
- 及时更新安全补丁
- 保持日志定期清理