redis 簡單官方指令碼安裝方法 linux

2021-06-22 08:51:18 字數 4945 閱讀 5963

redis 簡單官方指令碼安裝方法(linux), 其實也是非常簡單的,安裝的時候,我用一台剛剛安裝好的虛擬機器來模擬環境。現在我安裝官方**的最新版本

.gz2.解壓到當前目錄

tar 

-zxvf redis

-2.6

.16.tar

.gz

3.安裝

make prefix

=/opt/

module

/redis

/release

/redis

-2.6.16

install

cd redis

-2.6.16

/utils

ln -s /

opt/

module

/redis

/release

/redis

-2.6.16

/bin

/redis-*/

usr/

local

/bin

/#新增到環境變數中

./install_server

.sh

#執行這個檔案他會預設生成一些

redis

的配置檔案

######如果執行這指令碼的時候發生下面的錯誤###########################

[root@localhost utils

]#./

install_server

.sh

welcome

to the redis service installer

this

script will help you easily

setup a running redis server

please

select the redis port

forthis

instance:[

6379

]selecting

default

:6379

please

select the redis config file name

[/etc/

redis

/6379.conf

]selected

default

-/etc/

redis

/6379.conf

please

select the redis log file name

[/var/

log/

redis_6379

.log

]selected

default

-/var/

log/

redis_6379

.log

please

select the data directory

forthis

instance

[/var/

lib/

redis

/6379

]selected

default

-/var/

lib/

redis

/6379

please

select the redis executable path

[/usr/

local

/bin

/redis

-server]s

#^port [0

-9]$

#port

6379#;s

#^logfile .+$

#logfile

/var

/log

/redis_6379

.log#;s

#^dir .+$

#dir

/var

/lib

/redis

/6379#;s

#^pidfile .+$

#pidfile

/var

/run

/redis_6379

.pid#;s

#^daemonize no$

#daemonize yes

#;copied

/tmp

/6379.conf

=>

/etc

/init.d

/redis_6379

installing

service

..../

install_server.sh

:line

178:

update-rc

.d:command not found

exists

,process is already running or crashed

解析

welcome

to the redis service installer

this

script will help you easily

setup a running redis server

please

select the redis port

forthis instance:[

6379

]#redis 配置的埠

selecting

default

:6379

#預設為6379

please

select the redis config file name

[/etc

/redis

/6379.conf

]#redis預設檔案存放路徑

selected

default -/

etc/

redis

/6379.conf

please

select the redis log file name

[/var

/log

/redis_6379

.log

]#redis 日誌檔案路徑

selected

default -/

var/

log/

redis_6379

.log

please

select the data directory

forthis instance

[/var

/lib

/redis

/6379

]selected

default -/

var/

lib/

redis

/6379

please

select the redis executable path

[/opt

/bin

/redis

-server

]

注意,你安裝的時候,有可能出現的bug

#######因為install_server.sh這個安裝指令碼有bug#####################################

vim install_server.sh

##第乙個點

###修改前-if

[!`which chkconfig`];

then

###修改後+if

[!`which chkconfig`];

then

#combine the header and the template (which is actually a static footer)

echo $redis_init_header

>

$tmp_file

&&cat $init_tpl_file

>>

$tmp_file

||die

"could not write init script to $tmp_file"

else

##第二個點

###修改前-if

[!`which chkconfig`];

then

###修改後+if

[!`which chkconfig`];

then

#if we're not a chkconfig box assume we're able to use update-rc.d

update-rc

.d redis_$redis_port defaults

&&echo

"success!"

else

###修改完成後,再次執行,應該沒問題的了

4.啟動redis

/

etc/

init.d

/redis_6379 start

5.測試

redis

-cli

6.結果:

[

root@localhost utils

]# redis-cli

redis

127.0

.0.1

:6379

>

setname oyhk

okredis

127.0

.0.1

:6379

>

get name

"oyhk"

redis

127.0

.0.1

:6379

>

安裝完成!

redis集群安裝指令碼

yum install gcc mkdir opt package cd opt package wget tar zxvf redis 3.2.4.tar.gz mv redis 3.2.4 usr local redis dir usr local redis cd dir make make ...

MAC安裝redis最簡單的方法

使用mac的包管理工具brew一行命令搞定安裝。若未安裝brew,命令列先輸入以下命令安裝brew。usr bin ruby e curl fssl 安裝redis brew install redis 3.2 後面 接版本號可指定版本1.啟動redis服務 brew services start ...

shell指令碼之redis自動安裝

bin bash yum install cpp binutils glibc kernheaders glibc common glibc devel gcc make wget 安裝依賴庫 wget if f root redis 4.0.1.tar.gz then tar zxvf redis...