在centos7上安裝redis的方法
關(guān)閉防火墻:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall開(kāi)機(jī)啟動(dòng)
firewall-cmd --state #查看默認(rèn)防火墻狀態(tài)(關(guān)閉后顯示notrunning,開(kāi)啟后顯示running)
配置編譯環(huán)境:
sudo yum install gcc-c++
下載源碼:
wget http://download.redis.io/releases/redis-3.2.8.tar.gz
解壓源碼:
tar -zxvf redis-3.2.8.tar.gz
進(jìn)入到解壓目錄:
cd redis-3.2.8
執(zhí)行make編譯Redis:
make MALLOC=libc
注意:make命令執(zhí)行完成編譯后,會(huì)在src目錄下生成6個(gè)可執(zhí)行文件,分別是redis-server、redis-cli、redis-benchmark、redis-check-aof、redis-check-rdb、redis-sentinel。
安裝Redis:
make install
配置Redis能隨系統(tǒng)啟動(dòng):
./utils/install_server.sh
顯示結(jié)果信息如下:
Welcome to the redis service installer
This script will help you easily set up a running redis server
Please select the redis port for this 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 for this instance [/var/lib/redis/6379]
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/local/bin/redis-server]
Selected config:
Port : 6379
Config file : /etc/redis/6379.conf
Log file : /var/log/redis_6379.log
Data dir : /var/lib/redis/6379
Executable : /usr/local/bin/redis-server
Cli Executable : /usr/local/bin/redis-cli
Is this ok? Then press ENTER to go on or Ctrl-C to abort.
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
Successfully added to chkconfig!
Successfully added to runlevels 345!
Starting Redis server...
Installation successful!
Redis服務(wù)查看、開(kāi)啟、關(guān)閉:
a.通過(guò)ps -ef|grep redis命令查看Redis進(jìn)程
b.開(kāi)啟Redis服務(wù)操作通過(guò)/etc/init.d/redis_6379 start命令,也可通過(guò)(service redis_6379 start)
c.關(guān)閉Redis服務(wù)操作通過(guò)/etc/init.d/redis_6379 stop命令,也可通過(guò)(service redis_6379 stop)
redis.conf 的配置信息
1、daemonize 如果需要在后臺(tái)運(yùn)行,把該項(xiàng)改為yes
2、pidfile 配置多個(gè)pid的地址 默認(rèn)在/var/run/redis.pid
3、bind 綁定ip,設(shè)置后只接受來(lái)自該ip的請(qǐng)求
4、port 監(jiān)聽(tīng)端口,默認(rèn)是6379
5、loglevel 分為4個(gè)等級(jí):debug verbose notice warning
6、logfile 用于配置log文件地址
7、databases 設(shè)置數(shù)據(jù)庫(kù)個(gè)數(shù),默認(rèn)使用的數(shù)據(jù)庫(kù)為0
8、save 設(shè)置redis進(jìn)行數(shù)據(jù)庫(kù)鏡像的頻率。
9、rdbcompression 在進(jìn)行鏡像備份時(shí),是否進(jìn)行壓縮
10、dbfilename 鏡像備份文件的文件名
11、Dir 數(shù)據(jù)庫(kù)鏡像備份的文件放置路徑
12、Slaveof 設(shè)置數(shù)據(jù)庫(kù)為其他數(shù)據(jù)庫(kù)的從數(shù)據(jù)庫(kù)
13、Masterauth 主數(shù)據(jù)庫(kù)連接需要的密碼驗(yàn)證
14、Requriepass 設(shè)置 登陸時(shí)需要使用密碼
15、Maxclients 限制同時(shí)使用的客戶數(shù)量
16、Maxmemory 設(shè)置redis能夠使用的最大內(nèi)存
17、Appendonly 開(kāi)啟append only模式
18、Appendfsync 設(shè)置對(duì)appendonly.aof文件同步的頻率(對(duì)數(shù)據(jù)進(jìn)行備份的第二種方式)
19、vm-enabled 是否開(kāi)啟虛擬內(nèi)存支持 (vm開(kāi)頭的參數(shù)都是配置虛擬內(nèi)存的)
20、vm-swap-file 設(shè)置虛擬內(nèi)存的交換文件路徑
21、vm-max-memory 設(shè)置redis使用的最大物理內(nèi)存大小
22、vm-page-size 設(shè)置虛擬內(nèi)存的頁(yè)大小
23、vm-pages 設(shè)置交換文件的總的page數(shù)量
24、vm-max-threads 設(shè)置VM IO同時(shí)使用的線程數(shù)量
25、Glueoutputbuf 把小的輸出緩存存放在一起
26、hash-max-zipmap-entries 設(shè)置hash的臨界值
27、Activerehashing 重新hash
相關(guān)文章
shell編程基礎(chǔ) 單引號(hào)和雙引號(hào)的區(qū)別
單引號(hào)和雙引號(hào)都能關(guān)閉shell對(duì)特殊字符的處理。不同的是,雙引號(hào)沒(méi)有單引號(hào)嚴(yán)格,單引號(hào)關(guān)閉所有有特殊作用的字符,而雙引號(hào)只要求shell忽略大多數(shù),具體的說(shuō),就是①美元符號(hào)②反引號(hào)③反斜杠,這3種特殊字符不被忽略。 不忽略美元符號(hào)意味著shell在雙引號(hào)內(nèi)部也進(jìn)行變量名替換。2008-04-04
淺析Linux操作系統(tǒng)登錄帳戶的管理和審計(jì)
淺析Linux操作系統(tǒng)登錄帳戶的管理和審計(jì)...2006-10-10
免費(fèi)的Linux在構(gòu)建綠色校園網(wǎng)中的應(yīng)用
免費(fèi)的Linux在構(gòu)建綠色校園網(wǎng)中的應(yīng)用...2006-10-10
Linux 自動(dòng)喚醒和關(guān)閉的實(shí)現(xiàn)方法
這篇文章主要介紹了Linux 自動(dòng)喚醒和關(guān)閉的實(shí)現(xiàn)方法,需要的朋友可以參考下2018-01-01
ubuntu 14.04 oracle 11g 64位數(shù)據(jù)庫(kù)安裝圖文教程
這篇文章主要介紹了ubuntu 14.04 oracle 11g 64位數(shù)據(jù)庫(kù)安裝圖文教程,需要的朋友可以參考下2017-05-05

