1
0

fix: kvdb install for arm64

This commit is contained in:
2024-07-09 10:02:31 +08:00
parent 6b14855085
commit 5339846f88
13 changed files with 59 additions and 61 deletions

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

@@ -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 #################################
@@ -501,6 +503,7 @@ dir /usr/local/db/bin/conf
# 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
@@ -556,7 +559,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 +969,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 +1807,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
@@ -2056,6 +2058,8 @@ server-threads 2
# replicas will still sync in the normal way and incorrect ordering when
# bringing up replicas can result in data loss (the first master will win).
# active-replica yes
active-replica yes
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
@@ -2081,6 +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

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,7 +63,10 @@ chmod +rx ${RPM_BUILD_ROOT}/usr/lib64/*
# 安装完成后执行
%post
RedisConfDir=/usr/local/db/bin/conf
OmcRootDir=/usr/local/omc
DependDir=${OmcRootDir}/depends
RedisBinDir=/usr/local/bin
RedisConfDir=/usr/local/etc/kvdb
OMCEtcDir=/usr/local/omc/etc
FERootDir=/usr/local/omc/htdocs/front
UsrLib64Dir=/usr/lib64
@@ -82,13 +85,19 @@ 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 ${DependDir}/kvdb/* /
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 +126,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
@@ -153,26 +162,26 @@ 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 +205,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