Files
nms_cxy/README.md
2024-03-25 15:38:13 +08:00

86 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# nms_cxy
网络管理系统-北向接口
功能以网管主程序为基础包
- 中国星网网络创新研究院-北向模块 `src\modules\nms_cxy`
## redis 配置文件相关
```conf
# IP绑定与端口
bind 0.0.0.0
port 6379
# 安全设置
protected-mode yes
requirepass ""
# 从节点只能读取数据,不能直接写入数据
slaveof 192.168.114.114 6379
# 允许从节点进行读写操作
replica-read-only no
```
## 开发
```sh
# 安装 Go版本 1.21.6 后进入项目根目录
cd ./omc
# 下载依赖
go mod download
# 调试启动
go run omc.go -c ./omc/etc/omc.yaml --env local
# 打包命名 omc
go build -ldflags="-s -w" -o omc
```
## 单程序打包
```sh
go env -w GOOS=linux
go env -w GOOS=windows
go build -o omc -v -ldflags "-X 'nms_cxy/lib/global.Version=2.2311.8' -X 'nms_cxy/lib/global.BuildTime=`date`' -X 'nms_cxy/lib/global.GoVer=`go version`'"
```
## Deb 打包
`build` 目录内 `build\debbuild` 修改配置
- 版本号VERSION=2.2403.3
- 项目路径EmsBEDir=/home/agtuser/probject/nms_cxy
```sh
# 可执行
chmod +x build.sh && ./build.sh deb
# 卸载程序
dpkg -r omc
sudo rm -rf /usr/local/omc
# 安装程序
dpkg -i omc-xxx.deb
# 安装 Nginx
apt install -y nginx
# 1解除gzip注释 2注释conf.d下面的一行
vim /etc/nginx/nginx.conf
# 检查配置
vim /etc/nginx/conf.d/default.conf
# 重启 Nginx
systemctl restart nginx
# 安装 Mysql
# 修改初始数据库连接地址
vim /usr/local/omc/bin/importdb.sh
# 执行安装
/usr/local/omc/bin/importdb.sh install
# 服务重启
sudo /usr/local/omc/bin/omcsvc.sh restart
```