1
0

Merge branch 'main' into multi-tenant

This commit is contained in:
2024-07-09 15:16:56 +08:00
41 changed files with 4375 additions and 2056 deletions

View File

@@ -1,271 +1,20 @@
SET FOREIGN_KEY_CHECKS = 0;
REPLACE
INTO `sys_config` (
`config_id`,
`config_name`,
`config_key`,
`config_value`,
`config_type`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
106,
'config.sys.title',
'sys.title',
'config.sys.titleValue',
'Y',
'supervisor',
1698110000000,
NULL,
0,
'config.sys.titleRemark'
);
--
REPLACE INTO `sys_config` VALUES (6, 'config.sys.officialUrl', 'sys.officialUrl', 'https://www.agrandtech.com', 'Y', 'supervisor', 1700000000000, NULL, 0, 'config.sys.officialUrlRemark');
REPLACE INTO `sys_config` VALUES (106, 'config.sys.title', 'sys.title', 'config.sys.titleValue', 'Y', 'supervisor', 1700000000000, NULL, 0, 'config.sys.titleRemark');
REPLACE INTO `sys_config` VALUES (107, 'config.sys.copyright', 'sys.copyright', 'config.sys.copyrightValue', 'Y', 'supervisor', 1700000000000, NULL, 0, 'config.sys.copyrightRemark');
REPLACE INTO `sys_config` VALUES (108, 'config.sys.i18nOpen', 'sys.i18n.open', 'true', 'Y', 'supervisor', 1700000000000, NULL, 0, 'config.sys.i18nOpenRemark');
REPLACE INTO `sys_config` VALUES (109, 'config.sys.i18nDefault', 'sys.i18n.default', 'en_US', 'Y', 'supervisor', 1700000000000, NULL, 0, 'config.sys.i18nDefaultRemark');
REPLACE
INTO `sys_config` (
`config_id`,
`config_name`,
`config_key`,
`config_value`,
`config_type`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
107,
'config.sys.copyright',
'sys.copyright',
'config.sys.copyrightValue',
'Y',
'supervisor',
1698110000000,
NULL,
0,
'config.sys.copyrightRemark'
);
REPLACE
INTO `sys_config` (
`config_id`,
`config_name`,
`config_key`,
`config_value`,
`config_type`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
108,
'config.sys.i18nOpen',
'sys.i18n.open',
'true',
'Y',
'supervisor',
1698110000000,
NULL,
0,
'config.sys.i18nOpenRemark'
);
REPLACE
INTO `sys_config` (
`config_id`,
`config_name`,
`config_key`,
`config_value`,
`config_type`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
109,
'Internationalization Default Language',
'sys.i18n.default',
'en_US',
'Y',
'supervisor',
1698110000000,
'supervisor',
1702632906566,
'config.sys.i18nDefaultRemark'
);
REPLACE
INTO `sys_config` (
`config_id`,
`config_name`,
`config_key`,
`config_value`,
`config_type`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
6,
'config.sys.officialUrl',
'sys.officialUrl',
'https://www.agrandtech.com',
'Y',
'supervisor',
1698110000000,
'admin',
1700809804330,
'config.sys.officialUrlRemark'
);
REPLACE
INTO `sys_dict_data` (
`dict_code`,
`dict_sort`,
`dict_label`,
`dict_value`,
`dict_type`,
`tag_class`,
`tag_type`,
`status`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
1660,
1660,
'config.sys.titleValue',
'AGrandEMS',
'i18n_zh',
NULL,
NULL,
'1',
'supervisor',
1699350000000,
NULL,
0,
NULL
);
REPLACE
INTO `sys_dict_data` (
`dict_code`,
`dict_sort`,
`dict_label`,
`dict_value`,
`dict_type`,
`tag_class`,
`tag_type`,
`status`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
3660,
3660,
'config.sys.titleValue',
'AGrandEMS',
'i18n_en',
NULL,
NULL,
'1',
'supervisor',
1699350000000,
NULL,
0,
NULL
);
REPLACE
INTO `sys_dict_data` (
`dict_code`,
`dict_sort`,
`dict_label`,
`dict_value`,
`dict_type`,
`tag_class`,
`tag_type`,
`status`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
1661,
1661,
'config.sys.copyrightValue',
'Copyright ©2023 千通科技',
'i18n_zh',
NULL,
NULL,
'1',
'supervisor',
1699350000000,
NULL,
0,
NULL
);
REPLACE
INTO `sys_dict_data` (
`dict_code`,
`dict_sort`,
`dict_label`,
`dict_value`,
`dict_type`,
`tag_class`,
`tag_type`,
`status`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
3661,
3661,
'config.sys.copyrightValue',
'Copyright ©2023 AGrandTech',
'i18n_en',
NULL,
NULL,
'1',
'supervisor',
1699350000000,
NULL,
0,
NULL
);
--
REPLACE INTO `sys_dict_data` VALUES (1660, 1660, 'config.sys.titleValue', 'AGrand EMS', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1661, 1661, 'config.sys.copyrightValue', 'Copyright ©2023 千通科技', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3660, 3660, 'config.sys.titleValue', 'AGrand EMS', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3661, 3661, 'config.sys.copyrightValue', 'Copyright ©2023 AGrandTech', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
-- set internationalization switching to ON
-- REPLACE
-- INTO `sys_role_menu` (`role_id`, `menu_id`)
-- VALUES (2, 2122);
UPDATE `sys_menu`
SET
`status` = '1'
WHERE
`menu_id` = 2122;
-- REPLACE INTO `omc_db`.`sys_role_menu` (`role_id`, `menu_id`) VALUES (2, 2122);
UPDATE `sys_menu` SET `status` = '1' WHERE `menu_id` = 2122;
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -1,269 +1,20 @@
SET FOREIGN_KEY_CHECKS = 0;
REPLACE
INTO `sys_config` (
`config_id`,
`config_name`,
`config_key`,
`config_value`,
`config_type`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
106,
'config.sys.title',
'sys.title',
'config.sys.titleValue',
'Y',
'supervisor',
1698110000000,
NULL,
0,
'config.sys.titleRemark'
);
REPLACE
INTO `sys_config` (
`config_id`,
`config_name`,
`config_key`,
`config_value`,
`config_type`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
107,
'config.sys.copyright',
'sys.copyright',
'config.sys.copyrightValue',
'Y',
'supervisor',
1698110000000,
NULL,
0,
'config.sys.copyrightRemark'
);
--
REPLACE INTO `sys_config` VALUES (6, 'config.sys.officialUrl', 'sys.officialUrl', 'https://www.bluearcus.com', 'Y', 'supervisor', 1700000000000, NULL, 0, 'config.sys.officialUrlRemark');
REPLACE INTO `sys_config` VALUES (106, 'config.sys.title', 'sys.title', 'config.sys.titleValue', 'Y', 'supervisor', 1700000000000, NULL, 0, 'config.sys.titleRemark');
REPLACE INTO `sys_config` VALUES (107, 'config.sys.copyright', 'sys.copyright', 'config.sys.copyrightValue', 'Y', 'supervisor', 1700000000000, NULL, 0, 'config.sys.copyrightRemark');
REPLACE INTO `sys_config` VALUES (108, 'config.sys.i18nOpen', 'sys.i18n.open', 'false', 'Y', 'supervisor', 1700000000000, NULL, 0, 'config.sys.i18nOpenRemark');
REPLACE INTO `sys_config` VALUES (109, 'config.sys.i18nDefault', 'sys.i18n.default', 'en_US', 'Y', 'supervisor', 1700000000000, NULL, 0, 'config.sys.i18nDefaultRemark');
REPLACE
INTO `sys_config` (
`config_id`,
`config_name`,
`config_key`,
`config_value`,
`config_type`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
108,
'config.sys.i18nOpen',
'sys.i18n.open',
'false',
'Y',
'supervisor',
1698110000000,
NULL,
0,
'config.sys.i18nOpenRemark'
);
--
REPLACE INTO `sys_dict_data` VALUES (1660, 1660, 'config.sys.titleValue', 'BlueArcus EMS', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (1661, 1661, 'config.sys.copyrightValue', 'Copyright ©2023 BlueArcus', 'i18n_zh', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3660, 3660, 'config.sys.titleValue', 'BlueArcus EMS', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE INTO `sys_dict_data` VALUES (3661, 3661, 'config.sys.copyrightValue', 'Copyright ©2023 BlueArcus', 'i18n_en', NULL, NULL, '1', 'supervisor', 1700000000000, NULL, 0, NULL);
REPLACE
INTO `sys_config` (
`config_id`,
`config_name`,
`config_key`,
`config_value`,
`config_type`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
109,
'Internationalization Default Language',
'sys.i18n.default',
'en_US',
'Y',
'supervisor',
1698110000000,
'supervisor',
1702632906566,
'config.sys.i18nDefaultRemark'
);
REPLACE
INTO `sys_config` (
`config_id`,
`config_name`,
`config_key`,
`config_value`,
`config_type`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
6,
'config.sys.officialUrl',
'sys.officialUrl',
'https://www.bluearcus.com',
'Y',
'supervisor',
1698110000000,
'admin',
1700809804330,
'config.sys.officialUrlRemark'
);
REPLACE
INTO `sys_dict_data` (
`dict_code`,
`dict_sort`,
`dict_label`,
`dict_value`,
`dict_type`,
`tag_class`,
`tag_type`,
`status`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
1660,
1660,
'config.sys.titleValue',
'BlueArcus EMS',
'i18n_zh',
NULL,
NULL,
'1',
'supervisor',
1699350000000,
NULL,
0,
NULL
);
REPLACE
INTO `sys_dict_data` (
`dict_code`,
`dict_sort`,
`dict_label`,
`dict_value`,
`dict_type`,
`tag_class`,
`tag_type`,
`status`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
3660,
3660,
'config.sys.titleValue',
'BlueArcus EMS',
'i18n_en',
NULL,
NULL,
'1',
'supervisor',
1699350000000,
NULL,
0,
NULL
);
REPLACE
INTO `sys_dict_data` (
`dict_code`,
`dict_sort`,
`dict_label`,
`dict_value`,
`dict_type`,
`tag_class`,
`tag_type`,
`status`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
1661,
1661,
'config.sys.copyrightValue',
'Copyright ©2023 BlueArcus',
'i18n_zh',
NULL,
NULL,
'1',
'supervisor',
1699350000000,
NULL,
0,
NULL
);
REPLACE
INTO `sys_dict_data` (
`dict_code`,
`dict_sort`,
`dict_label`,
`dict_value`,
`dict_type`,
`tag_class`,
`tag_type`,
`status`,
`create_by`,
`create_time`,
`update_by`,
`update_time`,
`remark`
)
VALUES (
3661,
3661,
'config.sys.copyrightValue',
'Copyright ©2023 BlueArcus',
'i18n_en',
NULL,
NULL,
'1',
'supervisor',
1699350000000,
NULL,
0,
NULL
);
-- set internationalization switching to OFF
-- DELETE FROM `sys_role_menu` WHERE `menu_id` = 2122;
UPDATE `sys_menu`
SET
`status` = '0'
WHERE
`menu_id` = 2122;
-- set internationalization switching to ON
-- REPLACE INTO `omc_db`.`sys_role_menu` (`role_id`, `menu_id`) VALUES (2, 2122);
UPDATE `sys_menu` SET `status` = '0' WHERE `menu_id` = 2122;
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -1,15 +1,16 @@
# !/bin/bash
RedisRootDir=/usr/local
OMCRootDir=/usr/local/omc
RedisOldRootDir=/usr/local/db
RedisConfDir=${RedisRootDir}/etc/adb
DependsRootDir=/usr/local/omc/depends
RedisConfDir=${RedisRootDir}/etc/kvdb
DependsRootDir=${OMCRootDir}/depends
SystemdRootDir=/lib/systemd/system
OMCEtcDir=/usr/local/omc/etc
FERootDir=/usr/local/omc/htdocs/front
OMCEtcDir=${OMCRootDir}/etc
FERootDir=${OMCRootDir}/htdocs/front
X86Lib64Dir=/lib/x86_64-linux-gnu
OmcBinDir=/usr/local/omc/bin
OMCStaticDir=/usr/local/omc/static
OmcBinDir=${OMCRootDir}/bin
OMCStaticDir=${OMCRootDir}/static
UsrLocalBinDir=/usr/local/bin
OmcDaemon=omcd
NginxEtcDir=/etc/nginx
@@ -24,7 +25,7 @@ echo " sudo systemctl start/stop/restart/status restagent.service"
echo " sudo systemctl start/stop/restart/status crontask.service"
echo " sudo systemctl start/stop/restart/status sshsvc.service"
echo " sudo systemctl start/stop/restart/status captrace.service"
echo " sudo systemctl start/stop/restart/status adb.service"
echo " sudo systemctl start/stop/restart/status kvdb.service"
echo " or run: "
echo " sudo /usr/local/omc/bin/omcsvc.sh start/stop/restart/status"
echo ""
@@ -42,10 +43,10 @@ if [ ! -e libwsutil.so ]; then ln -s libwsutil.so.13.1.0 libwsutil.so; fi
cd ${UsrLocalBinDir}
if [ ! -e ${OmcDaemon} ]; then ln -s ${OmcBinDir}/omcsvc.sh ${OmcDaemon}; fi
chmod +rx /usr/local/omc/bin/*
chmod +rx /usr/local/omc/*
chmod +rx /usr/local/bin/*
chmod -R 755 /usr/local/omc/htdocs/front
chmod +rx ${OMCRootDir}/bin/*
chmod +rx ${OMCRootDir}/*
chmod +rx ${UsrLocalBinDir}/*
chmod -R 755 ${OMCRootDir}/htdocs/front
for CFile in ${CFileList}; do
if [ ! -e "${OMCEtcDir}/${CFile}" ]; then
@@ -57,42 +58,54 @@ for CFile in ${CFileList}; do
done
# Install redis db if not exist /usr/local/db
if [ ! -e "${RedisRootDir}/bin/adb-server" ]; then
if [ ! -e "${RedisRootDir}/bin/kvdb-server" ]; then
# if [ ! -e "${RedisRootDir}" ]; then
# mkdir -p ${RedisRootDir}
# fi
# stop old adb service
if [ -e "${RedisOldRootDir}/bin/redis-server" ] && [ -e "${SystemdRootDir}/adb.service" ]; then
systemctl stop adb.service
systemctl disable adb.service
fi
cp -rf ${DependsRootDir}/adb/* /
chmod +rx ${RedisRootDir}/bin/*
if [ ! -e "${RedisConfDir}/adb.conf" ]; then
cp ${RedisConfDir}/default/adb.conf ${RedisConfDir}
# stop adb service
if [ -e "${UsrLocalBinDir}/adb-server" ] && [ -e "${SystemdRootDir}/adb.service" ]; then
systemctl stop adb.service
systemctl disable adb.service
fi
cp -rf ${DependsRootDir}/kvdb/* /
chmod +rx ${RedisRootDir}/bin/kvdb*
if [ ! -e "${RedisConfDir}/kvdb.conf" ]; then
cp ${RedisConfDir}/default/kvdb.conf ${RedisConfDir}
fi
sed -i 's/replica-read-only yes/replica-read-only no/g' ${RedisConfDir}/adb.conf
sed -i 's/replica-read-only yes/replica-read-only no/g' ${RedisConfDir}/kvdb.conf
LINE="masterauth helloearth"
FILE="${RedisConfDir}/adb.conf"
FILE="${RedisConfDir}/kvdb.conf"
# 检查文件中是否存在该行
if ! grep -qxF "$LINE" "$FILE"; then
# 如果不存在,将其添加到文件末尾
echo "$LINE" >> "$FILE"
fi
# copy the orangin dump.rdb
if [ -e "${RedisOldRootDir}/bin/conf/dump.rdb" ]; then
cp -f ${RedisOldRootDir}/bin/conf/dump.rdb ${RedisConfDir}
# copy the old adb dump.rdb
if [ -e "${RedisOldRootDir}/bin/conf/dump.rdb" ] && [ ! -e "${RedisRootDir}/etc/kvdb/dump.rdb" ]; then
cp -f ${RedisOldRootDir}/bin/conf/dump.rdb ${RedisRootDir}/etc/kvdb/;
mv -f ${RedisRootDir}/db ${RedisRootDir}/adb.old
fi
# cp -f ${DependsRootDir}/systemd/adb.service ${SystemdRootDir}
else
if [ ! -e "${RedisConfDir}/adb.conf" ]; then
cp ${RedisConfDir}/default/adb.conf ${RedisConfDir}
fi
sed -i 's/replica-read-only yes/replica-read-only no/g' ${RedisConfDir}/adb.conf
# copy the adb dump.rdb
if [ -e "${RedisRootDir}/etc/adb/dump.rdb" ] && [ ! -e "${RedisRootDir}/etc/kvdb/dump.rdb" ]; then
cp -f ${RedisRootDir}/etc/adb/dump.rdb ${RedisRootDir}/etc/kvdb/;
mv -f ${RedisRootDir}/etc/adb ${RedisRootDir}/etc/adb.old
fi
# cp -f ${DependsRootDir}/systemd/kvdb.service ${SystemdRootDir}
else
if [ ! -e "${RedisConfDir}/kvdb.conf" ]; then
cp ${RedisConfDir}/default/kvdb.conf ${RedisConfDir}
fi
sed -i 's/replica-read-only yes/replica-read-only no/g' ${RedisConfDir}/kvdb.conf
LINE="masterauth helloearth"
FILE="${RedisConfDir}/adb.conf"
FILE="${RedisConfDir}/kvdb.conf"
# 检查文件中是否存在该行
if ! grep -qxF "$LINE" "$FILE"; then
# 如果不存在,将其添加到文件末尾
@@ -131,16 +144,16 @@ systemctl enable restagent.service
systemctl enable crontask.service
systemctl enable sshsvc.service
systemctl enable captrace.service
systemctl enable adb.service
systemctl enable kvdb.service
systemctl daemon-reload
systemctl stop nginx.service
systemctl stop restagent.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
systemctl stop adb.service
systemctl stop kvdb.service
systemctl start nginx.service
systemctl start adb.service
systemctl start kvdb.service
systemctl start crontask.service
systemctl start sshsvc.service
systemctl start captrace.service

View File

@@ -13,14 +13,15 @@ systemctl stop restagent.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
systemctl stop adb.service
#systemctl stop kvdb.service
#rm -rf /usr/local/omc
rm -rf /etc/nginx/conf.d/omc.conf
rm -f /usr/local/bin/omcd
systemctl disable restagent.service
systemctl disable crontask.service
systemctl disable sshsvc.service
systemctl disable captrace.service
systemctl disable adb.service
#systemctl disable kvdb.service
systemctl daemon-reload

View File

@@ -1,6 +1,6 @@
[Service]
Type=forking
ExecStart=/usr/local/bin/adb-server /usr/local/etc/adb/adb.conf
ExecStart=/usr/local/bin/kvdb-server /usr/local/etc/kvdb/kvdb.conf
ExecStopPost=
PIDFile=
Restart=always

View File

@@ -304,7 +304,7 @@ daemonize yes
#
# Creating a pid file is best effort: if Redis is not able to create it
# nothing bad happens, the server will start and run normally.
pidfile /var/run/adb-server.pid
pidfile /var/run/kvdb-server.pid
# Specify the server verbosity level.
# This can be one of:
@@ -312,13 +312,14 @@ pidfile /var/run/adb-server.pid
# verbose (many rarely useful info, but not a mess like the debug level)
# notice (moderately verbose, what you want in production probably)
# warning (only very important / critical messages are logged)
loglevel notice
#loglevel notice
loglevel warning
# Specify the log file name. Also the empty string can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
#logfile /usr/local/etc/adb/log/adb-server.log
logfile ""
#logfile /usr/local/etc/kvdb/log/kvdb-server.log
logfile /usr/local/etc/kvdb/log/kvdb-server.log
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
@@ -471,7 +472,7 @@ rdb-del-sync-files no
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir /usr/local/etc/adb
dir /usr/local/etc/kvdb
################################# REPLICATION #################################
@@ -2081,7 +2082,3 @@ replica-weighting-factor 2
# disk space or any other I/O error Redis will instead use memory.
#
# blob-support false
# set slave of UDM primary redis
slaveof 172.16.5.140 6379
masterauth helloearth

View File

@@ -84,7 +84,7 @@
# mode.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#bind 127.0.0.1 -::1
bind 127.0.0.1 172.16.5.140
bind 127.0.0.1
# Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.
@@ -304,7 +304,7 @@ daemonize yes
#
# Creating a pid file is best effort: if Redis is not able to create it
# nothing bad happens, the server will start and run normally.
pidfile /var/run/adb-server.pid
pidfile /var/run/kvdb-server.pid
# Specify the server verbosity level.
# This can be one of:
@@ -312,13 +312,14 @@ pidfile /var/run/adb-server.pid
# verbose (many rarely useful info, but not a mess like the debug level)
# notice (moderately verbose, what you want in production probably)
# warning (only very important / critical messages are logged)
loglevel notice
#loglevel notice
loglevel warning
# Specify the log file name. Also the empty string can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
#logfile /usr/local/etc/adb/log/adb-server.log
logfile ""
#logfile /usr/local/etc/kvdb/log/kvdb-server.log
logfile /usr/local/etc/kvdb/log/kvdb-server.log
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
@@ -471,7 +472,7 @@ rdb-del-sync-files no
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir /usr/local/etc/adb
dir /usr/local/etc/kvdb
################################# REPLICATION #################################
@@ -502,6 +503,7 @@ dir /usr/local/etc/adb
# refuse the replica request.
#
# masterauth <master-password>
masterauth helloearth
#
# However this is not enough if you are using Redis ACLs (for Redis version
# 6 or greater), and the default user is not capable of running the PSYNC
@@ -2057,8 +2059,7 @@ server-threads 2
# bringing up replicas can result in data loss (the first master will win).
# active-replica yes
active-replica yes
replicaof 172.16.5.141 6379
masterauth helloearth
replicaof 10.0.0.2 6379
# Redis will attempt to balance clients across threads evenly; However, replica clients
# are usually much more expensive than a normal client, and so Redis will try to assign
@@ -2084,7 +2085,3 @@ replica-weighting-factor 2
# disk space or any other I/O error Redis will instead use memory.
#
# blob-support false
# set slave of UDM primary redis
slaveof 172.16.5.140 6379
masterauth helloearth

View File

@@ -1,15 +1,16 @@
# !/bin/bash
RedisRootDir=/usr/local
OMCRootDir=/usr/local/omc
RedisOldRootDir=/usr/local/db
RedisConfDir=${RedisRootDir}/etc/adb
DependsRootDir=/usr/local/omc/depends
RedisConfDir=${RedisRootDir}/etc/kvdb
DependsRootDir=${OMCRootDir}/depends
SystemdRootDir=/lib/systemd/system
OMCEtcDir=/usr/local/omc/etc
FERootDir=/usr/local/omc/htdocs/front
OMCEtcDir=${OMCRootDir}/etc
FERootDir=${OMCRootDir}/htdocs/front
X86Lib64Dir=/lib/x86_64-linux-gnu
OmcBinDir=/usr/local/omc/bin
OMCStaticDir=/usr/local/omc/static
OmcBinDir=${OMCRootDir}/bin
OMCStaticDir=${OMCRootDir}/static
UsrLocalBinDir=/usr/local/bin
OmcDaemon=omcd
NginxEtcDir=/etc/nginx
@@ -24,7 +25,7 @@ echo " sudo systemctl start/stop/restart/status restagent.service"
echo " sudo systemctl start/stop/restart/status crontask.service"
echo " sudo systemctl start/stop/restart/status sshsvc.service"
echo " sudo systemctl start/stop/restart/status captrace.service"
echo " sudo systemctl start/stop/restart/status adb.service"
echo " sudo systemctl start/stop/restart/status kvdb.service"
echo " or run: "
echo " sudo /usr/local/omc/bin/omcsvc.sh start/stop/restart/status"
echo ""
@@ -42,10 +43,10 @@ if [ ! -e libwsutil.so ]; then ln -s libwsutil.so.13.1.0 libwsutil.so; fi
cd ${UsrLocalBinDir}
if [ ! -e ${OmcDaemon} ]; then ln -s ${OmcBinDir}/omcsvc.sh ${OmcDaemon}; fi
chmod +rx /usr/local/omc/bin/*
chmod +rx /usr/local/omc/*
chmod +rx /usr/local/bin/*
chmod -R 755 /usr/local/omc/htdocs/front
chmod +rx ${OMCRootDir}/bin/*
chmod +rx ${OMCRootDir}/*
chmod +rx ${UsrLocalBinDir}/*
chmod -R 755 ${OMCRootDir}/htdocs/front
for CFile in ${CFileList}; do
if [ ! -e "${OMCEtcDir}/${CFile}" ]; then
@@ -57,42 +58,54 @@ for CFile in ${CFileList}; do
done
# Install redis db if not exist /usr/local/db
if [ ! -e "${RedisRootDir}/bin/adb-server" ]; then
if [ ! -e "${RedisRootDir}/bin/kvdb-server" ]; then
# if [ ! -e "${RedisRootDir}" ]; then
# mkdir -p ${RedisRootDir}
# fi
# stop old adb service
if [ -e "${RedisOldRootDir}/bin/redis-server" ] && [ -e "${SystemdRootDir}/adb.service" ]; then
systemctl stop adb.service
systemctl disable adb.service
fi
cp -rf ${DependsRootDir}/adb/* /
chmod +rx ${RedisRootDir}/bin/*
if [ ! -e "${RedisConfDir}/adb.conf" ]; then
cp ${RedisConfDir}/default/adb.conf ${RedisConfDir};
# stop adb service
if [ -e "${UsrLocalBinDir}/adb-server" ] && [ -e "${SystemdRootDir}/adb.service" ]; then
systemctl stop adb.service
systemctl disable adb.service
fi
cp -rf ${DependsRootDir}/kvdb/* /
chmod +rx ${RedisRootDir}/bin/kvdb*
if [ ! -e "${RedisConfDir}/kvdb.conf" ]; then
cp ${RedisConfDir}/default/kvdb.conf ${RedisConfDir};
fi
sed -i 's/replica-read-only yes/replica-read-only no/g' ${RedisConfDir}/adb.conf
sed -i 's/replica-read-only yes/replica-read-only no/g' ${RedisConfDir}/kvdb.conf
LINE="masterauth helloearth"
FILE="${RedisConfDir}/adb.conf"
FILE="${RedisConfDir}/kvdb.conf"
# 检查文件中是否存在该行
if ! grep -qxF "$LINE" "$FILE"; then
# 如果不存在,将其添加到文件末尾
echo "$LINE" >> "$FILE"
fi
# copy the orangin dump.rdb
if [ -e "${RedisOldRootDir}/bin/conf/dump.rdb" ]; then
# copy the old adb dump.rdb
if [ -e "${RedisOldRootDir}/bin/conf/dump.rdb" ] && [ ! -e "${RedisConfDir}/dump.rdb" ]; then
cp -f ${RedisOldRootDir}/bin/conf/dump.rdb ${RedisConfDir};
mv -f ${RedisRootDir}/db ${RedisRootDir}/adb.old
fi
# cp -f ${DependsRootDir}/systemd/adb.service ${SystemdRootDir}
else
if [ ! -e "${RedisConfDir}/adb.conf" ]; then
cp ${RedisConfDir}/default/adb.conf ${RedisConfDir}
fi
sed -i 's/replica-read-only yes/replica-read-only no/g' ${RedisConfDir}/adb.conf
# copy the adb dump.rdb
if [ -e "${RedisRootDir}/etc/adb/dump.rdb" ] && [ ! -e "${RedisRootDir}/etc/kvdb/dump.rdb" ]; then
cp -f ${RedisRootDir}/etc/adb/dump.rdb ${RedisRootDir}/etc/kvdb/;
mv -f ${RedisRootDir}/etc/adb ${RedisRootDir}/etc/adb.old
fi
# cp -f ${DependsRootDir}/systemd/kvdb.service ${SystemdRootDir}
else
if [ ! -e "${RedisConfDir}/kvdb.conf" ]; then
cp ${RedisConfDir}/default/kvdb.conf ${RedisConfDir}
fi
sed -i 's/replica-read-only yes/replica-read-only no/g' ${RedisConfDir}/kvdb.conf
LINE="masterauth helloearth"
FILE="${RedisConfDir}/adb.conf"
FILE="${RedisConfDir}/kvdb.conf"
# 检查文件中是否存在该行
if ! grep -qxF "$LINE" "$FILE"; then
# 如果不存在,将其添加到文件末尾
@@ -131,16 +144,16 @@ systemctl enable restagent.service
systemctl enable crontask.service
systemctl enable sshsvc.service
systemctl enable captrace.service
systemctl enable adb.service
systemctl enable kvdb.service
systemctl daemon-reload
systemctl stop nginx.service
systemctl stop restagent.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
systemctl stop adb.service
systemctl stop kvdb.service
systemctl start nginx.service
systemctl start adb.service
systemctl start kvdb.service
systemctl start crontask.service
systemctl start sshsvc.service
systemctl start captrace.service

View File

@@ -13,14 +13,15 @@ systemctl stop restagent.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
systemctl stop adb.service
#systemctl stop kvdb.service
#rm -rf /usr/local/omc
rm -rf /etc/nginx/conf.d/omc.conf
rm -f /usr/local/bin/omcd
systemctl disable restagent.service
systemctl disable crontask.service
systemctl disable sshsvc.service
systemctl disable captrace.service
systemctl disable adb.service
#systemctl disable kvdb.service
systemctl daemon-reload

View File

@@ -1,6 +1,6 @@
[Service]
Type=forking
ExecStart=/usr/local/bin/adb-server /usr/local/etc/adb/adb.conf
ExecStart=/usr/local/bin/kvdb-server /usr/local/etc/kvdb/kvdb.conf
ExecStopPost=
PIDFile=
Restart=always

View File

@@ -84,7 +84,7 @@
# mode.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#bind 127.0.0.1 -::1
bind 127.0.0.1
bind 127.0.0.1
# Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.
@@ -304,7 +304,7 @@ daemonize yes
#
# Creating a pid file is best effort: if Redis is not able to create it
# nothing bad happens, the server will start and run normally.
pidfile /var/run/redis/redis-server.pid
pidfile /var/run/kvdb-server.pid
# Specify the server verbosity level.
# This can be one of:
@@ -312,12 +312,14 @@ pidfile /var/run/redis/redis-server.pid
# verbose (many rarely useful info, but not a mess like the debug level)
# notice (moderately verbose, what you want in production probably)
# warning (only very important / critical messages are logged)
loglevel notice
#loglevel notice
loglevel warning
# Specify the log file name. Also the empty string can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
logfile /usr/local/db/log/adb-server.log
#logfile /usr/local/etc/kvdb/log/kvdb-server.log
logfile /usr/local/etc/kvdb/log/kvdb-server.log
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
@@ -470,7 +472,7 @@ rdb-del-sync-files no
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir /usr/local/db/bin/conf
dir /usr/local/etc/kvdb
################################# REPLICATION #################################
@@ -556,7 +558,7 @@ replica-serve-stale-data yes
# such as CONFIG, DEBUG, and so forth. To a limited extent you can improve
# security of read only replicas using 'rename-command' to shadow all the
# administrative / dangerous commands.
replica-read-only no
replica-read-only yes
# Replication SYNC strategy: disk or socket.
#
@@ -966,6 +968,7 @@ acllog-max-len 128
# command, these will cause requirepass to be ignored.
#
# requirepass foobared
requirepass helloearth
# New users are initialized with restrictive permissions by default, via the
# equivalent of this ACL rule 'off resetkeys -@all'. Starting with Redis 6.2, it
@@ -1803,10 +1806,8 @@ activerehashing yes
#
# Both the hard or the soft limit can be disabled by setting them to zero.
client-output-buffer-limit normal 0 0 0
#client-output-buffer-limit replica 256mb 64mb 60
#client-output-buffer-limit pubsub 32mb 8mb 60
client-output-buffer-limit replica 0 0 0
client-output-buffer-limit pubsub 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
# Client query buffers accumulate new commands. They are limited to a fixed
# amount by default in order to avoid that a protocol desynchronization (for
@@ -2081,6 +2082,3 @@ replica-weighting-factor 2
# disk space or any other I/O error Redis will instead use memory.
#
# blob-support false
# set slave of UDM primary redis
slaveof 172.16.5.140 6379

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@@ -1,6 +1,6 @@
[Service]
Type=forking
ExecStart=/usr/local/db/bin/redis-server /usr/local/db/bin/conf/redis.conf
ExecStart=/usr/local/bin/kvdb-server /usr/local/etc/kvdb/kvdb.conf
ExecStopPost=
PIDFile=
Restart=always
@@ -8,3 +8,4 @@ RestartSec=3
[Install]
WantedBy=multi-user.target

View File

@@ -84,7 +84,7 @@
# mode.
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#bind 127.0.0.1 -::1
bind 127.0.0.1
bind 127.0.0.1
# Protected mode is a layer of security protection, in order to avoid that
# Redis instances left open on the internet are accessed and exploited.
@@ -304,7 +304,7 @@ daemonize yes
#
# Creating a pid file is best effort: if Redis is not able to create it
# nothing bad happens, the server will start and run normally.
pidfile /var/run/redis/redis-server.pid
pidfile /var/run/kvdb-server.pid
# Specify the server verbosity level.
# This can be one of:
@@ -312,12 +312,14 @@ pidfile /var/run/redis/redis-server.pid
# verbose (many rarely useful info, but not a mess like the debug level)
# notice (moderately verbose, what you want in production probably)
# warning (only very important / critical messages are logged)
loglevel notice
#loglevel notice
loglevel warning
# Specify the log file name. Also the empty string can be used to force
# Redis to log on the standard output. Note that if you use standard
# output for logging but daemonize, logs will be sent to /dev/null
logfile /usr/local/db/log/adb-server.log
#logfile /usr/local/etc/kvdb/log/kvdb-server.log
logfile /usr/local/etc/kvdb/log/kvdb-server.log
# To enable logging to the system logger, just set 'syslog-enabled' to yes,
# and optionally update the other syslog parameters to suit your needs.
@@ -470,7 +472,7 @@ rdb-del-sync-files no
# The Append Only File will also be created inside this directory.
#
# Note that you must specify a directory here, not a file name.
dir /usr/local/db/bin/conf
dir /usr/local/etc/kvdb
################################# REPLICATION #################################
@@ -556,7 +558,7 @@ replica-serve-stale-data yes
# such as CONFIG, DEBUG, and so forth. To a limited extent you can improve
# security of read only replicas using 'rename-command' to shadow all the
# administrative / dangerous commands.
replica-read-only no
replica-read-only yes
# Replication SYNC strategy: disk or socket.
#
@@ -966,6 +968,7 @@ acllog-max-len 128
# command, these will cause requirepass to be ignored.
#
# requirepass foobared
requirepass helloearth
# New users are initialized with restrictive permissions by default, via the
# equivalent of this ACL rule 'off resetkeys -@all'. Starting with Redis 6.2, it
@@ -1803,10 +1806,8 @@ activerehashing yes
#
# Both the hard or the soft limit can be disabled by setting them to zero.
client-output-buffer-limit normal 0 0 0
#client-output-buffer-limit replica 256mb 64mb 60
#client-output-buffer-limit pubsub 32mb 8mb 60
client-output-buffer-limit replica 0 0 0
client-output-buffer-limit pubsub 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
# Client query buffers accumulate new commands. They are limited to a fixed
# amount by default in order to avoid that a protocol desynchronization (for
@@ -2081,6 +2082,3 @@ replica-weighting-factor 2
# disk space or any other I/O error Redis will instead use memory.
#
# blob-support false
# set slave of UDM primary redis
slaveof 172.16.5.140 6379

View File

@@ -1,10 +0,0 @@
[Service]
Type=forking
ExecStart=/usr/local/db/bin/redis-server /usr/local/db/bin/conf/redis.conf
ExecStopPost=
PIDFile=
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target

View File

@@ -33,7 +33,7 @@ cd ${RPM_BUILD_ROOT}
cp -rf ${RPM_BUILD_DIR}/* ${RPM_BUILD_ROOT}/
chmod +rx ${RPM_BUILD_ROOT}/usr/local/omc
chmod +rx ${RPM_BUILD_ROOT}/usr/local/omc/*
chmod +rx ${RPM_BUILD_ROOT}/usr/local/db/bin/*
# chmod +rx ${RPM_BUILD_ROOT}/usr/local/db/bin/*
chmod +rx ${RPM_BUILD_ROOT}/usr/local/bin/*
chmod -R 755 ${RPM_BUILD_ROOT}/usr/local/omc/htdocs/front
chmod +rx ${RPM_BUILD_ROOT}/usr/lib64/*
@@ -55,7 +55,7 @@ chmod +rx ${RPM_BUILD_ROOT}/usr/lib64/*
#cp -f systemd/crontask.service ${RPM_BUILD_ROOT}/lib/systemd/system/crontask.service
#cp -f systemd/sshsvc.service ${RPM_BUILD_ROOT}/lib/systemd/system/sshsvc.service
#cp -f systemd/captrace.service ${RPM_BUILD_ROOT}/lib/systemd/system/captrace.service
#cp -f systemd/adb.service ${RPM_BUILD_ROOT}/lib/systemd/system/adb.service
#cp -f systemd/kvdb.service ${RPM_BUILD_ROOT}/lib/systemd/system/kvdb.service
%build
#cd %{buildroot}/..
@@ -63,12 +63,15 @@ chmod +rx ${RPM_BUILD_ROOT}/usr/lib64/*
# 安装完成后执行
%post
RedisConfDir=/usr/local/db/bin/conf
OMCEtcDir=/usr/local/omc/etc
FERootDir=/usr/local/omc/htdocs/front
OmcRootDir=/usr/local/omc
DependsRootDir=${OmcRootDir}/depends
RedisBinDir=/usr/local/bin
RedisConfDir=/usr/local/etc/kvdb
OMCEtcDir=${OmcRootDir}/etc
FERootDir=${OmcRootDir}/htdocs/front
UsrLib64Dir=/usr/lib64
OmcBinDir=/usr/local/omc/bin
OMCStaticDir=/usr/local/omc/static
OmcBinDir=${OmcRootDir}/bin
OMCStaticDir=${OmcRootDir}/static
UsrLocalBinDir=/usr/local/bin
OmcDaemon=omcd
NginxEtcDir=/etc/nginx
@@ -82,13 +85,21 @@ for CFile in ${CFileList}; do
cp -f ${OMCEtcDir}/default/${CFile} ${OMCEtcDir}
fi
done
if [ ! -e "${RedisConfDir}/adb.conf" ]; then
cp ${RedisConfDir}/default/adb.conf ${RedisConfDir};
# Check if install kvdb
if [ ! -e "${RedisBinDir}/kvdb-server" ]; then
cp -rf ${DependsRootDir}/kvdb/* /
chmod 755 ${RedisBinDir}/kvdb*
systemctl enable kvdb.service
fi
sed -i 's/replica-read-only yes/replica-read-only no/g' ${RedisConfDir}/adb.conf
if [ ! -e "${RedisConfDir}/kvdb.conf" ]; then
cp ${RedisConfDir}/default/kvdb.conf ${RedisConfDir};
fi
sed -i 's/replica-read-only yes/replica-read-only no/g' ${RedisConfDir}/kvdb.conf
LINE="masterauth helloearth"
FILE="${RedisConfDir}/adb.conf"
FILE="${RedisConfDir}/kvdb.conf"
if ! grep -qxF "$LINE" "$FILE"; then
# 如果不存在,将其添加到文件末尾
echo "$LINE" >> "$FILE"
@@ -117,22 +128,22 @@ if [ ! -e libwsutil.so.13 ]; then ln -s libwsutil.so.13.1.0 libwsutil.so.13; fi
if [ ! -e libwsutil.so ]; then ln -s libwsutil.so.13.1.0 libwsutil.so; fi
cd ${UsrLocalBinDir}
if [ ! -e ${OmcDaemon} ]; then ln -s ${OmcBinDir}/omcsvc.sh ${OmcDaemon}; fi
sed -i 's/listen 80;/listen 1080;/g' ${NginxEtcDir}/nginx.conf
sed -i 's/listen \[::\]:80;/listen \[::\]:1080;/g' ${NginxEtcDir}/nginx.conf
# sed -i 's/listen 80;/listen 1080;/g' ${NginxEtcDir}/nginx.conf
# sed -i 's/listen \[::\]:80;/listen \[::\]:1080;/g' ${NginxEtcDir}/nginx.conf
systemctl daemon-reload
systemctl enable restagent.service
systemctl enable crontask.service
systemctl enable sshsvc.service
systemctl enable captrace.service
systemctl enable adb.service
#systemctl enable kvdb.service
systemctl stop restagent.service
systemctl stop crontask.service
systemctl stop sshsvc.service
systemctl stop captrace.service
systemctl stop nginx.service
systemctl stop adb.service
systemctl start adb.service
systemctl start nginx.service
# systemctl stop nginx.service
systemctl stop kvdb.service
systemctl start kvdb.service
# systemctl start nginx.service
systemctl start captrace.service
systemctl start sshsvc.service
systemctl start crontask.service
@@ -140,6 +151,7 @@ systemctl start restagent.service
# 卸载时执行
%postun
UsrLocalBinDir=/usr/local/bin
UsrLib64Dir=/usr/lib64
cd ${UsrLib64Dir}
rm libwireshark.so.15
@@ -148,31 +160,32 @@ rm libwiretap.so.12
rm libwiretap.so
rm libwsutil.so.13
rm libwsutil.so
rm -f ${UsrLocalBinDir}/omcd
if [ "$1" = "0" ] ; then
sudo systemctl stop restagent.service
sudo systemctl stop crontask.service
sudo systemctl stop sshsvc.service
sudo systemctl stop captrace.service
sudo systemctl stop adb.service
sudo systemctl stop nginx.service
#sudo systemctl stop kvdb.service
#sudo systemctl stop nginx.service
#rm -rf /usr/local/omc
rm -rf /etc/nginx/conf.d/omc.conf
sudo systemctl disable restagent.service
sudo systemctl disable crontask.service
sudo systemctl disable sshsvc.service
sudo systemctl disable captrace.service
sudo systemctl disable adb.service
#sudo systemctl disable kvdb.service
sudo systemctl daemon-reload
else
sudo systemctl daemon-reload
sudo systemctl stop nginx.service
#sudo systemctl stop nginx.service
sudo systemctl stop restagent.service
sudo systemctl stop crontask.service
sudo systemctl stop sshsvc.service
sudo systemctl stop captrace.service
sudo systemctl stop adb.service
sudo systemctl start nginx.service
sudo systemctl start adb.service
#sudo systemctl stop kvdb.service
#sudo systemctl start nginx.service
sudo systemctl start kvdb.service
sudo systemctl start crontask.service
sudo systemctl start sshsvc.service
sudo systemctl start captrace.service
@@ -196,13 +209,12 @@ fi
/usr/local/omc/database
/usr/local/omc/static
/usr/local/omc/depends
/usr/local/db
/etc/nginx/conf.d/omc.conf
#/etc/nginx/conf.d/omc.conf
/lib/systemd/system/restagent.service
/lib/systemd/system/crontask.service
/lib/systemd/system/sshsvc.service
/lib/systemd/system/captrace.service
/lib/systemd/system/adb.service
#/lib/systemd/system/kvdb.service
/usr/lib64/libwireshark.so.15.0.12
/usr/lib64/libwiretap.so.12.0.12
/usr/lib64/libwsutil.so.13.1.0