Files
nms_cxy/README.md
2024-07-10 15:37:48 +08:00

136 lines
2.5 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 "helloearth"
# 查看主备
info replication
# 从节点只能读取数据,不能直接写入数据
# replicaof是新版本的命令旧版本是slaveof命令
slaveof 192.168.114.114 6379
replicaof 192.168.114.114 6379
masterauth "helloearth"
# 允许从节点进行读写操作
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 "-s -w -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
```
## 安装 Nginx
```sh
sudo apt install -y nginx
## 1 解除gzip相关注释
## 2 注释conf.d下面的一行
## include /etc/nginx/conf.d/*.conf;
sudo vim /etc/nginx/nginx.conf
# 检查配置
sudo cp -rf /usr/local/omc/etc/default/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
sudo vim /etc/nginx/conf.d/default.conf
# 重启 Nginx
sudo systemctl restart nginx
```
## 安装 Redis
```sh
sudo apt install kvdb-xx
# 修改配置
sudo vim /usr/local/etc/kvdb/kvdb.conf
# 找到以下配置修改
# protected-mode yes
# requirepass "helloearth"
# slaveof xxx.UDM的kvdb服务地址.xxx 6379
# masterauth "helloearth"
# 重启服务
sudo systemctl restart kvdb
```
## 安装 Mysql
```sh
sudo apt install mariadb-server
# 登录root设置密码
sudo mysql -u root
# ALTER USER 'root'@'localhost' IDENTIFIED BY '1000omc@kp!';
# FLUSH PRIVILEGES;
# 绑定IP端口
sudo vim /etc/mysql/mariadb.conf.d/50-server.cnf
#port = 33066
#bind-address = 127.0.0.1
# 重启服务
sudo systemctl restart mariadb
```
# 安装 OMC程序Deb
```sh
# 卸载程序
sudo dpkg -r omc
sudo rm -rf /usr/local/etc/omc
sudo rm -rf /usr/local/omc
# 安装程序
sudo dpkg -i omc-xxx.deb
# 初始化数据库
sudo /usr/local/omc/bin/setomc.sh -m install -c agt
# 服务重启
sudo service omc restart
```