Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
57f65ee18b !19 redis-sentinel命令提示需要“sentinel.conf”与实际不符
From: @cherry530
Reviewed-by: @yangzhao_kl
Signed-off-by: @yangzhao_kl
2021-12-06 03:53:24 +00:00
cherry530
1ea39e4c82 Fix display error warning message 2021-12-04 12:04:52 +08:00
openeuler-ci-bot
4340d14daf !17 [sync] PR-14: Upgrade redis5 to 5.0.14 for fix cves: CVE-2021-41099 CVE-2021-32762 CVE-2021-32675 CVE-2021-32687 CVE-2021-32628 CVE-2021-32627 CVE-2021-32626
From: @openeuler-sync-bot
Reviewed-by: @njlzk
Signed-off-by: @njlzk
2021-11-30 13:16:43 +00:00
starlet-dx
9cba34cc13 Upgrade redis5 to 5.0.14 for fix CVES
(cherry picked from commit ecc176663518cd1642147e322503af5baf6eb9ae)
2021-11-30 20:40:02 +08:00
openeuler-ci-bot
6ece37cb34 !9 Fix missing patch in source package
From: @ultra_planet
Reviewed-by: @zhengzhenyu
Signed-off-by: @zhengzhenyu
2021-09-03 02:03:44 +00:00
lingsheng
f6bc689f86 Fix missing patch in source package 2021-09-02 15:47:54 +08:00
openeuler-ci-bot
038e727389 !6 [sync] PR-5: Modify aarch64 architecture jemalloc page size from 4k to 64k
From: @openeuler-sync-bot
Reviewed-by: @zhengzhenyu
Signed-off-by: @zhengzhenyu
2021-03-31 09:51:42 +08:00
lingsheng
0586868700 Modify aarch64 architecture jemalloc page size from 4k to 64k
(cherry picked from commit a303113b5ba87a549f4f5f335c2b65354a0eeba0)
2021-03-31 09:15:11 +08:00
openeuler-ci-bot
f92b48363c !3 [sync] PR-2: Package init
From: @openeuler-sync-bot
Reviewed-by: @zhengzhenyu
Signed-off-by: @zhengzhenyu
2021-03-30 14:15:49 +08:00
hht8
fe06000a5b Package init
(cherry picked from commit 3bfecfeb9be6ca28d7c006d76abed451a5b7bf22)
2021-03-23 09:34:53 +08:00
14 changed files with 533 additions and 0 deletions

View File

@ -0,0 +1,13 @@
diff --git a/src/server.c b/src/server.c
index 4d5c702..4bdbf35 100644
--- a/src/server.c
+++ b/src/server.c
@@ -4365,7 +4365,7 @@ int main(int argc, char **argv) {
(int)getpid());
if (argc == 1) {
- serverLog(LL_WARNING, "Warning: no config file specified, using the default config. In order to specify a config file use %s /path/to/%s.conf", argv[0], server.sentinel_mode ? "sentinel" : "redis");
+ serverLog(LL_WARNING, "Warning: no config file specified, using the default config. In order to specify a config file use %s /path/to/%s.conf", argv[0], server.sentinel_mode ? "redis-sentinel" : "redis");
} else {
serverLog(LL_WARNING, "Configuration loaded");
}

View File

@ -0,0 +1,25 @@
From 8c4c3730d69ea1e3352d35e18999d42dca4c07e5 Mon Sep 17 00:00:00 2001
From: lingsheng <lingsheng@huawei.com>
Date: Mon, 29 Mar 2021 17:37:06 +0800
Subject: [PATCH] Modify aarch64 architecture jemalloc page size from 4k to 64k
---
deps/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/deps/Makefile b/deps/Makefile
index eb35c1e..2ba6ae3 100644
--- a/deps/Makefile
+++ b/deps/Makefile
@@ -77,7 +77,7 @@ JEMALLOC_LDFLAGS= $(LDFLAGS)
jemalloc: .make-prerequisites
@printf '%b %b\n' $(MAKECOLOR)MAKE$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR)
- cd jemalloc && ./configure --with-version=5.1.0-0-g0 --with-lg-quantum=3 --with-jemalloc-prefix=je_ --enable-cc-silence CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)"
+ cd jemalloc && ./configure --with-version=5.1.0-0-g0 --with-lg-quantum=3 --with-jemalloc-prefix=je_ --enable-cc-silence CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" --with-lg-page=16
cd jemalloc && $(MAKE) CFLAGS="$(JEMALLOC_CFLAGS)" LDFLAGS="$(JEMALLOC_LDFLAGS)" lib/libjemalloc.a
.PHONY: jemalloc
--
2.23.0

2
macros.redis Normal file
View File

@ -0,0 +1,2 @@
%redis_modules_abi 1
%redis_modules_dir %{_libdir}/redis/modules

BIN
redis-5.0.14.tar.gz Normal file

Binary file not shown.

BIN
redis-doc-4cd19bb.tar.gz Normal file

Binary file not shown.

6
redis-limit-init Normal file
View File

@ -0,0 +1,6 @@
# If you need to change max open file limit
# for example, when you change maxclient in configuration
# you can change the value below
# see "man limits.conf" for information
redis soft nofile 10240
redis hard nofile 10240

7
redis-limit-systemd Normal file
View File

@ -0,0 +1,7 @@
# If you need to change max open file limit
# for example, when you change maxclient in configuration
# you can change the LimitNOFILE value below
# see "man systemd.exec" for information
[Service]
LimitNOFILE=10240

94
redis-sentinel.init Normal file
View File

@ -0,0 +1,94 @@
#!/bin/sh
#
# redis init file for starting up the redis-sentinel daemon
#
# chkconfig: - 21 79
# description: Starts and stops the redis-sentinel daemon.
#
### BEGIN INIT INFO
# Provides: redis-sentinel
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Short-Description: start and stop Sentinel server
# Description: A persistent key-value database
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
name="redis-sentinel"
exec="/usr/bin/$name"
shut="/usr/libexec/redis-shutdown"
pidfile="/var/run/redis/sentinel.pid"
SENTINEL_CONFIG="/etc/redis-sentinel.conf"
[ -e /etc/sysconfig/redis-sentinel ] && . /etc/sysconfig/redis-sentinel
lockfile=/var/lock/subsys/redis
start() {
[ -f $SENTINEL_CONFIG ] || exit 6
[ -x $exec ] || exit 5
echo -n $"Starting $name: "
daemon --user ${REDIS_USER-redis} "$exec $SENTINEL_CONFIG --daemonize yes --pidfile $pidfile"
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $name: "
[ -x $shut ] && $shut $name
retval=$?
if [ -f $pidfile ]
then
# shutdown haven't work, try old way
killproc -p $pidfile $name
retval=$?
else
success "$name shutdown"
fi
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
rh_status() {
status -p $pidfile $name
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
exit 2
esac
exit $?

18
redis-sentinel.service Normal file
View File

@ -0,0 +1,18 @@
[Unit]
Description=Redis Sentinel
After=network.target
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/bin/redis-sentinel /etc/redis-sentinel.conf --supervised systemd
ExecStop=/usr/libexec/redis-shutdown redis-sentinel
Type=notify
User=redis
Group=redis
RuntimeDirectory=redis
RuntimeDirectoryMode=0755
[Install]
WantedBy=multi-user.target

40
redis-shutdown Normal file
View File

@ -0,0 +1,40 @@
#!/bin/bash
#
# Wrapper to close properly redis and sentinel
test x"$REDIS_DEBUG" != x && set -x
REDIS_CLI=/usr/bin/redis-cli
# Retrieve service name
SERVICE_NAME="$1"
if [ -z "$SERVICE_NAME" ]; then
SERVICE_NAME=redis
fi
# Get the proper config file based on service name
CONFIG_FILE="/etc/$SERVICE_NAME.conf"
# Use awk to retrieve host, port from config file
HOST=`awk '/^[[:blank:]]*bind/ { print $2 }' $CONFIG_FILE | tail -n1`
PORT=`awk '/^[[:blank:]]*port/ { print $2 }' $CONFIG_FILE | tail -n1`
PASS=`awk '/^[[:blank:]]*requirepass/ { print $2 }' $CONFIG_FILE | tail -n1`
SOCK=`awk '/^[[:blank:]]*unixsocket\s/ { print $2 }' $CONFIG_FILE | tail -n1`
# Just in case, use default host, port
HOST=${HOST:-127.0.0.1}
if [ "$SERVICE_NAME" = redis ]; then
PORT=${PORT:-6379}
else
PORT=${PORT:-26739}
fi
# Setup additional parameters
# e.g password-protected redis instances
[ -z "$PASS" ] || ADDITIONAL_PARAMS="-a $PASS"
# shutdown the service properly
if [ -e "$SOCK" ] ; then
$REDIS_CLI -s $SOCK $ADDITIONAL_PARAMS shutdown
else
$REDIS_CLI -h $HOST -p $PORT $ADDITIONAL_PARAMS shutdown
fi

94
redis.init Normal file
View File

@ -0,0 +1,94 @@
#!/bin/sh
#
# redis init file for starting up the redis daemon
#
# chkconfig: - 20 80
# description: Starts and stops the redis daemon.
#
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $local_fs $remote_fs $network
# Required-Stop: $local_fs $remote_fs $network
# Short-Description: start and stop Redis server
# Description: A persistent key-value database
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
name="redis-server"
exec="/usr/bin/$name"
shut="/usr/libexec/redis-shutdown"
pidfile="/var/run/redis/redis.pid"
REDIS_CONFIG="/etc/redis.conf"
[ -e /etc/sysconfig/redis ] && . /etc/sysconfig/redis
lockfile=/var/lock/subsys/redis
start() {
[ -f $REDIS_CONFIG ] || exit 6
[ -x $exec ] || exit 5
echo -n $"Starting $name: "
daemon --user ${REDIS_USER-redis} "$exec $REDIS_CONFIG --daemonize yes --pidfile $pidfile"
retval=$?
echo
[ $retval -eq 0 ] && touch $lockfile
return $retval
}
stop() {
echo -n $"Stopping $name: "
[ -x $shut ] && $shut
retval=$?
if [ -f $pidfile ]
then
# shutdown haven't work, try old way
killproc -p $pidfile $name
retval=$?
else
success "$name shutdown"
fi
echo
[ $retval -eq 0 ] && rm -f $lockfile
return $retval
}
restart() {
stop
start
}
rh_status() {
status -p $pidfile $name
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
case "$1" in
start)
rh_status_q && exit 0
$1
;;
stop)
rh_status_q || exit 0
$1
;;
restart)
$1
;;
status)
rh_status
;;
condrestart|try-restart)
rh_status_q || exit 0
restart
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
exit 2
esac
exit $?

9
redis.logrotate Normal file
View File

@ -0,0 +1,9 @@
/var/log/redis/*.log {
weekly
rotate 10
copytruncate
delaycompress
compress
notifempty
missingok
}

18
redis.service Normal file
View File

@ -0,0 +1,18 @@
[Unit]
Description=Redis persistent key-value database
After=network.target
After=network-online.target
Wants=network-online.target
[Service]
ExecStart=/usr/bin/redis-server /etc/redis.conf --supervised systemd
ExecStop=/usr/libexec/redis-shutdown
Type=notify
User=redis
Group=redis
RuntimeDirectory=redis
RuntimeDirectoryMode=0755
[Install]
WantedBy=multi-user.target

207
redis5.spec Normal file
View File

@ -0,0 +1,207 @@
%bcond_with tests
%global doc_commit 4cd19bb1c3e3e00a8ff62a1dec5c2c6bcf9bc4bf
%global short_doc_commit %(c=%{doc_commit}; echo ${c:0:7})
%global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d)
%global make_flags DEBUG="" V="echo" LDFLAGS="%{?__global_ldflags}" CFLAGS+="%{optflags} -fPIC" INSTALL="install -p" PREFIX=%{buildroot}%{_prefix}
%global Pname redis
Name: redis5
Version: 5.0.14
Release: 2
Summary: A persistent key-value database
License: BSD and MIT
URL: https://redis.io
Source0: http://download.redis.io/releases/%{Pname}-%{version}.tar.gz
Source1: %{Pname}.logrotate
Source2: %{Pname}-sentinel.service
Source3: %{Pname}.service
Source4: %{Pname}-sentinel.init
Source5: %{Pname}.init
Source6: %{Pname}-shutdown
Source7: %{Pname}-limit-systemd
Source8: %{Pname}-limit-init
Source9: macros.%{Pname}
Source10: https://github.com/antirez/%{Pname}-doc/archive/%{doc_commit}/%{Pname}-doc-%{short_doc_commit}.tar.gz
Patch0001: Modify-aarch64-architecture-jemalloc-page-size-from-from-4k-to-64k.patch
Patch0002: Fix-display-error-message.patch
BuildRequires: gcc
%if %{with tests}
BuildRequires: procps-ng tcl
%endif
BuildRequires: systemd libatomic
Obsoletes: redis-trib < 5
Requires: /bin/awk logrotate
Provides: bundled(hiredis)
Provides: bundled(jemalloc)
Provides: bundled(lua-libs)
Provides: bundled(linenoise)
Provides: bundled(lzf)
Requires(pre): shadow-utils
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
Provides: redis(modules_abi) = 1
%description
Redis is an advanced key-value store. It is often referred to as a data
structure server since keys can contain strings, hashes, lists, sets and
sorted sets.
You can run atomic operations on these types, like appending to a string;
incrementing the value in a hash; pushing to a list; computing set
intersection, union and difference; or getting the member with highest
ranking in a sorted set.
In order to achieve its outstanding performance, Redis works with an
in-memory dataset. Depending on your use case, you can persist it either
by dumping the dataset to disk every once in a while, or by appending
each command to a log.
Redis also supports trivial-to-setup master-slave replication, with very
fast non-blocking first synchronization, auto-reconnection on net split
and so forth.
Other features include Transactions, Pub/Sub, Lua scripting, Keys with a
limited time-to-live, and configuration settings to make Redis behave like
a cache.
You can use Redis from most programming languages also.
%package devel
Summary: Development header for Redis module development
Provides: %{Pname}-static = %{version}-%{release}
%description devel
Header file required for building loadable Redis modules. Detailed
API documentation is available in the redis-doc package.
%package doc
Summary: Documentation for Redis
License: CC-BY-SA
BuildArch: noarch
Conflicts: redis < 4.0
%description doc
Detailed documentation for many aspects of Redis use,
administration and development.
%prep
tar -xvf %{SOURCE10}
%setup -n %{Pname}-%{version}
%ifarch aarch64
%patch0001 -p1
%endif
%patch0002 -p1
mv ../%{Pname}-doc-%{doc_commit} doc
mv deps/lua/COPYRIGHT COPYRIGHT-lua
mv deps/hiredis/COPYING COPYING-hiredis
sed -i -e 's|^logfile .*$|logfile /var/log/redis/redis.log|g' redis.conf
sed -i -e 's|^logfile .*$|logfile /var/log/redis/sentinel.log|g' sentinel.conf
sed -i -e 's|^dir .*$|dir /var/lib/redis|g' redis.conf
api=`sed -n -e 's/#define REDISMODULE_APIVER_[0-9][0-9]* //p' src/redismodule.h`
if test "$api" != "1"; then
: Error: Upstream API version is now ${api}, expecting %1.
: Update the redis_modules_abi macro, the rpmmacros file, and rebuild.
exit 1
fi
%build
make %{?_smp_mflags} %{make_flags} all
%install
make %{make_flags} install
install -d %{buildroot}%{_sharedstatedir}/%{Pname}
install -d %{buildroot}%{_localstatedir}/log/%{Pname}
install -d %{buildroot}%{_localstatedir}/run/%{Pname}
install -d %{buildroot}%{_libdir}/%{Pname}/modules
install -pDm644 %{S:1} %{buildroot}%{_sysconfdir}/logrotate.d/%{Pname}
install -pDm640 %{Pname}.conf %{buildroot}%{_sysconfdir}/%{Pname}.conf
install -pDm640 sentinel.conf %{buildroot}%{_sysconfdir}/%{Pname}-sentinel.conf
mkdir -p %{buildroot}%{_unitdir}
install -pm644 %{S:3} %{buildroot}%{_unitdir}
install -pm644 %{S:2} %{buildroot}%{_unitdir}
install -p -D -m 644 %{S:7} %{buildroot}%{_sysconfdir}/systemd/system/%{Pname}.service.d/limit.conf
install -p -D -m 644 %{S:7} %{buildroot}%{_sysconfdir}/systemd/system/%{Pname}-sentinel.service.d/limit.conf
chmod 755 %{buildroot}%{_bindir}/%{Pname}-*
install -pDm755 %{S:6} %{buildroot}%{_libexecdir}/%{Pname}-shutdown
install -pDm644 src/%{Pname}module.h %{buildroot}%{_includedir}/%{Pname}module.h
doc=$(echo %{buildroot}/%{_docdir}/%{Pname})
for page in 00-RELEASENOTES BUGS CONTRIBUTING MANIFESTO; do
install -Dpm644 $page $doc/$page
done
for page in $(find doc -name \*.md | sed -e 's|.md$||g'); do
base=$(echo $page | sed -e 's|doc/||g')
install -Dpm644 $page.md $doc/$base.md
done
mkdir -p %{buildroot}%{macrosdir}
install -pDm644 %{S:9} %{buildroot}%{macrosdir}/macros.%{Pname}
%if %{with tests}
%check
sed -e '/memefficiency/d' -i tests/test_helper.tcl
taskset -c 1 make %{make_flags} test
make %{make_flags} test-sentinel
%endif
%pre
getent group %{Pname} &> /dev/null || \
groupadd -r %{Pname} &> /dev/null
getent passwd %{Pname} &> /dev/null || \
useradd -r -g %{Pname} -d %{_sharedstatedir}/%{Pname} -s /sbin/nologin \
-c 'Redis Database Server' %{Pname} &> /dev/null
exit 0
%post
%systemd_post %{Pname}.service
%systemd_post %{Pname}-sentinel.service
%preun
%systemd_preun %{Pname}.service
%systemd_preun %{Pname}-sentinel.service
%postun
%systemd_postun_with_restart %{Pname}.service
%systemd_postun_with_restart %{Pname}-sentinel.service
%files
%{!?_licensedir:%global license %%doc}
%license COPYING
%config(noreplace) %{_sysconfdir}/logrotate.d/%{Pname}
%attr(0640, redis, root) %config(noreplace) %{_sysconfdir}/%{Pname}.conf
%attr(0640, redis, root) %config(noreplace) %{_sysconfdir}/%{Pname}-sentinel.conf
%dir %attr(0750, redis, redis) %{_libdir}/%{Pname}
%dir %attr(0750, redis, redis) %{_libdir}/%{Pname}/modules
%dir %attr(0750, redis, redis) %{_sharedstatedir}/%{Pname}
%dir %attr(0750, redis, redis) %{_localstatedir}/log/%{Pname}
%exclude %{macrosdir}
%exclude %{_includedir}
%exclude %{_docdir}/%{Pname}/*
%{_bindir}/%{Pname}-*
%{_libexecdir}/%{Pname}-*
%{_unitdir}/%{Pname}.service
%{_unitdir}/%{Pname}-sentinel.service
%dir %{_sysconfdir}/systemd/system/%{Pname}.service.d
%config(noreplace) %{_sysconfdir}/systemd/system/%{Pname}.service.d/limit.conf
%dir %{_sysconfdir}/systemd/system/%{Pname}-sentinel.service.d
%config(noreplace) %{_sysconfdir}/systemd/system/%{Pname}-sentinel.service.d/limit.conf
%dir %attr(0755, redis, redis) %ghost %{_localstatedir}/run/%{Pname}
%files devel
%license COPYING COPYRIGHT-lua COPYING-hiredis
%{_includedir}/%{Pname}module.h
%{macrosdir}/*
%files doc
%docdir %{_docdir}/%{Pname}
%{_docdir}/%{Pname}
%changelog
* Sat Dec 04 2021 xu_ping <xuping33@huawei.com> - 5.0.14-2
- Fix display error message
* Tue Nov 30 2021 yaoxin <yaoxin30@huawei.com> - 5.0.14-1
- Upgrade redis5 to 5.0.14 for fix cves: CVE-2021-41099
CVE-2021-32762 CVE-2021-32675 CVE-2021-32687 CVE-2021-32626
CVE-2021-32627 CVE-2021-32628
* Thu Sep 02 2021 lingsheng <lingsheng@huawei.com> - 5.0.7-3
- Fix missing patch in source package
* Mon Mar 29 2021 lingsheng <lingsheng@huawei.com> - 5.0.7-2
- Modify aarch64 architecture jemalloc page size from 4k to 64k
* Sat Mar 20 2021 huanghaitao <huanghaitao8@huawei.com> - 5.0.7-1
- package init