run

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
wget http://download.redis.io/releases/redis-5.0.3.tar.gz
tar -xvf redis-5.0.3.tar.gz
cd redis-5.0.3
# 编译
make
# 安装
make PREFIX=/usr/local/redis install

# copy redis.conf
cp /data/install/redis-5.0.3/redis.conf /usr/local/redis
/usr/local/redis/bin/redis-server /usr/local/redis/redis.conf


if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
   echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
echo 1 > /proc/sys/vm/overcommit_memory
echo 511 > /proc/sys/net/core/somaxconn
#echo "net.core.somaxconn = 551" > /etc/sysctl.conf
#echo "vm.overcommit_memory=1" >> /etc/sysctl.conf
ulimit -n 10032


# run
/usr/local/redis/bin/redis-server /usr/local/redis/redis.conf

docker

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
curl -sfSLk https://raw.githubusercontent.com/antirez/redis/5.0/redis.conf \
|grep -v -e '^\s*#' -e '^\s*$' \
|sed -e 's@bind 127.0.0.1@bind 0.0.0.0@' \
|sed -e "s@protected-mode yes@protected-mode no@" \
|sed -e "s@appendonly no@appendonly yes@" > redis.conf


if test -f /sys/kernel/mm/transparent_hugepage/enabled; then   
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi

sysctl -w net.core.somaxconn=65535
 
docker run -it --rm -p 6379:6379 -v $(pwd)/redis.conf:/usr/local/etc/redis/redis.conf redis:5.0.7-buster redis-server /usr/local/etc/redis/redis.conf

docker run -it --rm redis:5.0.7-buster redis-cli -h 192.168.122.36 -p 6379

ref