From 61d79735c3c704ffb410e9d62cae8409b6f0173f24761052d4ab1700fa85d183 Mon Sep 17 00:00:00 2001 From: Lars Vogdt Date: Fri, 23 Jun 2017 11:36:02 +0000 Subject: [PATCH] Accepting request 505518 from home:computersalat:devel:database cleanup service file, add redis.sysctl file, add more info to README.SUSE OBS-URL: https://build.opensuse.org/request/show/505518 OBS-URL: https://build.opensuse.org/package/show/server:database/redis?expand=0&rev=93 --- README.SUSE | 14 +++++++++++++- redis.changes | 9 +++++++++ redis.spec | 5 +++++ redis.sysctl | 12 ++++++++++++ redis@.service | 4 ---- 5 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 redis.sysctl diff --git a/README.SUSE b/README.SUSE index 05cca9c..27ac5fb 100644 --- a/README.SUSE +++ b/README.SUSE @@ -13,13 +13,25 @@ dir /var/lib/redis/otherapp/ If you want to run more than one instance you also have to change the socket path and/or the ip:port combination. + e.g. /var/run/redis/otherapp.sock + +If you plan to use redis in combination with apache, then you should +add 'redis' to apache group and set 'unixsocketperm 770': +$ usermod -a -G redis wwwrun +$ systemctl restart apache2 +then apache is able to connect to redis socket Also make sure if you copy configurations from somewhere, that "daemonize" should be set to "no". -3. create the database dir: +3a. create the database dir: $ install -d -o redis -g redis -m 0750 /var/lib/redis/otherapp/ +3b. add limits (ulimit) to each service +$ install -d -m 0755 /etc/systemd/system/redis@otherapp.service.d +$ echo "[Service] +LimitNOFILE=10240" > /etc/systemd/system/redis@otherapp.service.d/limits.conf + 4. systemctl start redis@otherapp 5. systemctl enable redis@otherapp diff --git a/redis.changes b/redis.changes index ff9c2a9..4274d72 100644 --- a/redis.changes +++ b/redis.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Wed Jun 21 16:28:36 UTC 2017 - chris@computersalat.de + +- cleanup service file +- add redis.sysctl file +- update README.SUSE + * add info for socket usage per service + * add info for limits per service (LimitNOFILE=10240) + ------------------------------------------------------------------- Thu May 18 12:43:42 UTC 2017 - vsistek@suse.com diff --git a/redis.spec b/redis.spec index e8a80d7..578ec77 100644 --- a/redis.spec +++ b/redis.spec @@ -37,6 +37,7 @@ Source2: redis.target Source3: redis@.service Source4: redis.tmpfiles.d Source5: README.SUSE +Source6: %{name}.sysctl # PATCH-FIX-OPENSUSE -- openSUSE-style init script Patch0: %{name}-initscript.patch # PATCH-MISSING-TAG -- See http://wiki.opensuse.org/openSUSE:Packaging_Patches_guidelines @@ -96,6 +97,9 @@ perl -p -i -e 's|daemonize yes|daemonize no|g' redis.conf install -D -m 0640 redis.conf %{buildroot}%{_conf_dir}/default.conf.example install -D -m 0640 sentinel.conf %{buildroot}%{_conf_dir}/sentinel.conf.example +# some sysctl stuff +install -D -m 0644 %{S:6} %{buildroot}%{_sysconfdir}/sysctl.d/00-redis.conf + # # init # @@ -166,6 +170,7 @@ echo " sudo rcredis start; sudo chkconfig redis on" %defattr(-,root,root,-) %doc 00-RELEASENOTES BUGS CONTRIBUTING COPYING README.md %config(noreplace) %{_sysconfdir}/logrotate.d/%{name} +%config(noreplace) %{_sysconfdir}/sysctl.d/00-redis.conf %{_bindir}/redis-* %{_sbindir}/redis-* %{_sbindir}/rc%{name} diff --git a/redis.sysctl b/redis.sysctl new file mode 100644 index 0000000..6df0f96 --- /dev/null +++ b/redis.sysctl @@ -0,0 +1,12 @@ +### remove redis Warnings about + +# WARNING: The TCP backlog setting of 511 cannot be enforced because +# /proc/sys/net/core/somaxconn is set to the lower value of 128. +net.core.somaxconn=512 + +# WARNING overcommit_memory is set to 0! Background save may fail +# under low memory condition. To fix this issue add +# 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or +# run the command 'sysctl -w vm.overcommit_memory=1' for this to take +# effect. +vm.overcommit_memory=1 diff --git a/redis@.service b/redis@.service index d186781..7afc035 100644 --- a/redis@.service +++ b/redis@.service @@ -12,9 +12,5 @@ PIDFile=/var/run/redis/%i.pid ExecStart=/usr/sbin/redis-server /etc/redis/%i.conf Restart=on-failure -#ExecStart=/usr/sbin/openvpn --daemon --suppress-timestamps --writepid /var/run/openvpn/%i.pid --cd /etc/openvpn/ --config %i.conf -#ExecReload=/sbin/killproc -p /var/run/openvpn/%i.pid -HUP /usr/sbin/openvpn - [Install] WantedBy=multi-user.target redis.target -