From 3c186b34ae6afbd0f8b626b80859efd9f89d3047 Mon Sep 17 00:00:00 2001 From: TsMask <340112800@qq.com> Date: Wed, 10 Jul 2024 15:37:48 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E8=AF=B4=E6=98=8E?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 92 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 71 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index a439d95..c081766 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,14 @@ bind 0.0.0.0 port 6379 # 安全设置 protected-mode yes -requirepass "" +requirepass "helloearth" +# 查看主备 +info replication # 从节点只能读取数据,不能直接写入数据 +# replicaof是新版本的命令,旧版本是slaveof命令 slaveof 192.168.114.114 6379 +replicaof 192.168.114.114 6379 +masterauth "helloearth" # 允许从节点进行读写操作 replica-read-only no ``` @@ -43,7 +48,7 @@ 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`'" +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 打包 @@ -55,31 +60,76 @@ go build -o omc -v -ldflags "-X 'nms_cxy/lib/global.Version=2.2311.8' -X 'nms_cx ```sh # 可执行 -chmod +x build.sh && ./build.sh deb +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 # 卸载程序 -dpkg -r omc +sudo dpkg -r omc +sudo rm -rf /usr/local/etc/omc sudo rm -rf /usr/local/omc # 安装程序 -dpkg -i omc-xxx.deb +sudo 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/setomc.sh -m install -c agt # 服务重启 -sudo /usr/local/omc/bin/omcsvc.sh restart +sudo service omc restart ```