CenterOS中安裝Redis及開機啟動設定

2022-01-29 09:53:55 字數 2075 閱讀 4642

redis啟動

redisserver /path/to/redis.conf

redis關閉(預設port為6379)

rediscli -p port -a password shutdown  

檢視reids程序

ps -ef|grep redis

###########################

# chkconfig:

2345

9010

# description: redis

is a persistent key-value database

path=/usr/local/bin

redisport=6379

exec=/usr/local/bin/redis-server

redis_cli=/usr/local/bin/redis-cli

#redis密碼

password=yourpassword

pidfile=/var/run/redis.pid

conf="

/usr/local/reids/conf/redis.conf

"case"$1

"instart)

if [ -f $pidfile ]

then

echo

"$pidfile exists, process is already running or crashed

"else

echo

"starting redis server...

"$exec $conf

fiif [ "

$?"="0"

] then

echo

"redis is running..."fi

;;stop)

if [ ! -f $pidfile ]

then

echo

"$pidfile does not exist, process is not running

"else

pid=$(cat $pidfile)

echo

"stopping ...

"$redis_cli -p $redisport -a $password shutdown

while [ -x $ ]

doecho

"waiting for redis to shutdown ...

"sleep

1done

echo

"redis stopped"fi

;;restart|force-reload)

$ stop

$ start

;;*)

echo

"usage: /etc/init.d/redis

" >&2

exit

1esac

##############################

1) 最上面的注釋的意思是,redis服務必須在執行級2,3,4,5下被啟動或關閉,啟動的優先順序是90,關閉的優先順序是10。

2) 如果執行命令出現$'/r':command not found,這個問題是在windows下換行和linux下換行不同,可以通過nodepad++進行轉換。

chmod +x /etc/init.d/redis

sudo chkconfig redis on

service redis start   #或者 /etc/init.d/redis start

service redis stop #或者 /etc/init.d/redis stop

安裝node再centerOS中

新建目錄www 解壓 tar xvf node v8.0.0 linux x64.tar.xz測試是否安裝成功 進入解壓目錄下的bin目錄,執行ls命令 cd node v8.0.0 linux x64 bin ls有node和npm 測試.node v 安裝成功 現在node和npm還不能全域性使...

CenterOS中安裝Redis及開機啟動設定

wget tar xzf redis 5.0.8.tar.gz cd redis 5.0.8 make src redis serverredis啟動 redis server path to redis.conf redis關閉 預設port為6379 redis cli p port a pas...

CenterOS解除安裝和安裝MYSQL

1.首先在命令列輸入mysql,看一下本地計算機上是否有mysql。2.解除安裝mysql服務 首先檢視安裝的rpm的包 rpm qa grep mysql 對之前的服務進行刪除。rpm e mysql server yum y remove mysql lib 5.1.52 使用命令 rpm iv...