Redis安裝及配置

2021-10-07 08:54:17 字數 2429 閱讀 4883

一、redis安裝

[root@localhost ~]# yum install gcc gcc-c++ make -y

[root@localhost ~]# cd /opt/redis-5.0.4/

[root@localhost ~]# make #echo $?檢驗該命令是否執行成功

[root@localhost redis-5.0.4]# mkdir -p /data/redis/

[root@localhost redis-5.0.4]# make prefix=/data/redis install #echo $?檢驗該命令是否執行成功

[root@localhost redis-5.0.4]# mkdir /data/redis/conf

[root@localhost redis-5.0.4]# cp -p redis.conf /data/redis/conf/

二、生成的指令

[root@localhost redis-5.0.4]# cd /data/redis/bin/

[root@localhost bin]# ll

total 32700

-rwxr-xr-x. 1 root root 4366576 jun 20 16:25 redis-benchmark

-rwxr-xr-x. 1 root root 8101248 jun 20 16:25 redis-check-aof

-rwxr-xr-x. 1 root root 8101248 jun 20 16:25 redis-check-rdb

-rwxr-xr-x. 1 root root 4806800 jun 20 16:25 redis-cli

lrwxrwxrwx. 1 root root 12 jun 20 16:25 redis-sentinel -> redis-server

-rwxr-xr-x. 1 root root 8101248 jun 20 16:25 redis-server

三、啟動

[root@localhost bin]# /data/redis/bin/redis-server -h

[root@localhost bin]# /data/redis/bin/redis-server /data/redis/conf/redis.conf(此時服務已啟動,但程序未退出,重新開啟終端測試)

[root@localhost ~]# ps -ef | grep redis

root 12690 7705 0 16:27 pts/0 00:00:00 /data/redis/bin/redis-server 127.0.0.1:6379

root 12843 12714 0 16:30 pts/1 00:00:00 grep --color=auto redis

退出時,ctrl+c即可殺死程序,推出服務

若要程序一致執行,將程序放在後台使用

[root@localhost bin]# /data/redis/bin/redis-server /data/redis/conf/redis.conf &

關閉服務:

[root@localhost ~]# /data/redis/bin/redis-cli shutdown

[root@localhost ~]# ps -ef | grep redis

root 13012 12714 0 16:33 pts/1 00:00:00 grep --color=auto redis

四、調優

(1)核心引數

[root@localhost ~]# cat /proc/sys

sys/ sysrq-trigger sysvipc/

[root@localhost ~]# cat /proc/sys/net/core/somaxconn

128[root@localhost ~]# echo 1024 > /proc/sys/net/core/somaxconn

[root@localhost ~]# echo 1 > /proc/sys/vm/overcommit_memory

[root@localhost ~]# cat /sys/kernel/mm/transparent_hugepage/enabled

[always] madvise never

[root@localhost ~]# echo never > /sys/kernel/mm/transparent_hugepage/enabled

[root@localhost ~]# cat /sys/kernel/mm/transparent_hugepage/enabled

always madvise [never]

redis 安裝及配置介紹

1.2 解壓縮剛下好的redis包tar zxvf redis 5.0.3.tar.gz 1.3 進入剛才解壓好的redis資料夾中cd redis 5.0.3 1.4 make,友情提示,如果make被中斷,最好是刪除解壓好的資料夾,重新解壓縮一遍,否則可能make失敗 1.5 實驗啟動cd sr...

Redis安裝及配置 Linux

ubuntu 16.04安裝redis server apt get install redis server etc init.d redis server start etc init.d redis server stop etc init.d redis server restart etc...

Redis安裝及配置啟動方式

一 redis安裝 2 將原始碼包解壓至 opt cd 桌面 sudo tar zxvf redis 3.2.9.tar.gz c opt 3 此時cd進入解壓目錄 4 在繼續往下執行make命令就能安裝,但是redis是 c語言開發,安裝redis需要先講原始碼進行編譯,編譯依賴gcc環境.gcc...