redis

Would this work if one doesn't have the pro-pack? Could you share an example of the /home/TheirUserName/.redis/redis.sock file?

The socket you are asking about is not a text file. So it is not possible to show an example of its content. DirectAdmin offers a Redis interface and manager only under Pro-pack. But if you have a custom installation of Redis then you can also configure it to place individual sockets under users' home dirs.
 
Ok, i got it!!
Thank you all so much..

i just figured i'd give an A-to-Z summary of the procedure to enable Redis for one or more users in the non-Pro version of Directadmin..

there are a few things you'll need to replace first:
replace USERNAME as appropriate
replace PASSWORD as appropriate
replace php74 as appropriate
replace /usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902/ as appropriate (see below)
replace maxmemory 512MB as appropriate
replace maxmemory-samples 6 as appropriate

First, install the general components (you can just copy-paste into terminal):
Code:
cd /usr/local/directadmin/custombuild/build; \
.build set redis yes; \
.build redis; \
\
cd /usr/local/php74/bin; \
./pecl install igbinary igbinary-devel; \
./pecl install redis;
answer yes to the question:
"enable igbinary serializer support? [no] :"

Now, to find the path to the php extensions:
Code:
ll /usr/local/php74/lib/php/extensions;

For me, that was:
/usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902/
you need to replace that with your own below..

Then run this to add the necessary PHP extensions in order to access Redis from PHP (like, for WordPress):
Code:
echo "extension=/usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902/redis.so" >> /usr/local/php74/lib/php.conf.d/10-directadmin.ini; \
echo "extension=/usr/local/php74/lib/php/extensions/no-debug-non-zts-20190902/igbinary.so" >> /usr/local/php74/lib/php.conf.d/10-directadmin.ini; \
killall -9 lsphp;
(that last line is for LiteSpeed, i imagine for Apache PHP-FPM, it would be 'service php-fpm restart', and for Apache, it's probably 'service apache2 restart')

Now, to enable it for a given USERNAME (make sure to replace every instance of USERNAME, PASSWORD, etc.. with the correct values):
Code:
sudo -u USERNAME mkdir /home/USERNAME/.redis; \
chmod 770 /home/USERNAME/.redis; \
\
sudo -u USERNAME mkdir /home/USERNAME/.redis/db; \
chmod 770 /home/USERNAME/.redis/db; \
\
sudo -u USERNAME touch /home/USERNAME/.redis/redis.sock; \
chmod 770 /home/USERNAME/.redis/redis.sock; \
\
touch /usr/local/directadmin/data/users/USERNAME/redis.conf; \
chown diradmin.USERNAME /usr/local/directadmin/data/users/USERNAME/redis.conf; \
chmod 640 /usr/local/directadmin/data/users/USERNAME/redis.conf; \
\
{ echo "supervised systemd"; \
echo "port 0"; \
echo "unixsocket /home/USERNAME/.redis/redis.sock"; \
echo "unixsocketperm 770"; \
echo "requirepass PASSWORD"; \
echo "maxmemory 512MB"; \
echo "maxmemory-samples 6";  } > /usr/local/directadmin/data/users/USERNAME/redis.conf; \
\
systemctl daemon-reload; \
systemctl enable redis@USERNAME; \
systemctl start redis@USERNAME;

Finally, when it comes time to configure LiteSpeed Cache, or whatever PHP tool will be used to connect to Redis,
in the 'hostname' or 'IP address' field, you need to enter:
/home/USERNAME/.redis/redis.sock

You'll need to enter the password you provided in the config, and the port is 0
Thank you !!
@tristan @petersconsult

It works like a charm for Redis as Object Cache, any tips for Redis as Full Page Cache?

Thanks once again.
 
Hi @All

Do you know how to fix , do you have idea ? (without Directadmin Pro)

When i modify directadmin user
Directadmin remove a symlink redis@{USER}.service
/etc/systemd/system/multi-user.target.wants/[email protected]

Cannot use chattr
chattr: Operation not supported while reading flags on /etc/systemd/system/multi-user.target.wants/[email protected]

Thanks
 
Last edited:
i'm not sure i understand what's happening..
is this an error message, or what you're trying to do?
Directadmin remove a symlink redis@{USER}.service
/etc/systemd/system/multi-user.target.wants/[email protected]

if you're trying to remove that symlink, may i ask why?
 
Sorry for reviving an old topic, but I found this one when searching for how to remove Redis, when uninstalling rspamd. I replaced Spamassassin with rspamd as a test, following this guide: https://forum.directadmin.com/threads/rspamd-guide.56709/

Then wanted to go back to Spamassassin, and execute the commands under Undo!/Abort! in that topic.

But this leaves behind the Redis server:
_rspamd 18237 0.2 0.0 205444 720 ? Ssl Nov18 63:11 /usr/local/bin/redis-server unixsocket:/var/lib/rspamd/.redis/redis.sock

I think that's what the original question was about:
how to remove Redis server (and _rspamd user?) when rspamd is uninstalled via the guide?

I did
./build set redis no
./build remove_redis

But remove_redis does not exist.

What is the proper way to remove the Redis that is installed with rspamd?
 
Will you see it with
Code:
da build list_removals
?

It is not listed in list_removals. I started a new topic here, but I didn't find a solution yet:


Thanks!
 
Back
Top