Configure Redis with Unix Socket

Configure Redis with Unix Socket

sudo ps aux | grep redis

redis 78 0.0 0.0 31360 6800 ? Ssl Aug24 61:13 redis-server *:6379

sudo usermod -g nginx redis

Create your redis folder that the unix socket will be in.

sudo mkdir -p /var/run/redis/

Set the permissions so the redis user and www-data group own it

sudo chown -R redis:nginx /var/run/redis

Open your Redis configuration

sudo vi /etc/redis.conf

create a unix domain socket to listen on

unixsocket /var/run/redis/redis.sock
unixsocketperm 775

requirepass passwordtouse

bind 127.0.0.1
daemonize yes
stop-writes-on-bgsave-error no
rdbcompression yes

maximum memory allowed for redis

maxmemory 50M

how redis will evice old objects – least recently used

maxmemory-policy allkeys-lru

Save and Exit

Restart Redis

sudo service redis restart

See if the Redis unix socket was created

ls -lh /var/run/redis

And there we go

total 0
srwxr-xr-x 1 redis www-data 0 Sep 10 17:00 redis.sock

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다