1.redis是單執行緒,高效能的key/value記憶體資料,基於記憶體執行並支援持久化的nosql資料庫
2.redis主要用來做快取,但不僅僅是做快取,例如:redis的計數器生成分布式唯一主鍵,redis實現分布式鎖,佇列,會話快取
安裝單節點redis
1、安裝gcc套裝:
yum install cpp
yum install binutils
yum install glibc
yum install glibc-kernheaders
yum install glibc-common
yum install glibc-devel
yum install gcc
yum install make
2、公升級gcc
yum -y install centos-release-scl
yum -y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils
scl enable devtoolset-9 bash
3、設定永久公升級:
echo "source /opt/rh/devtoolset-9/enable" >>/etc/profile
4、安裝redis:
wget
tar xzf redis-6.0.3.tar.gz
cd redis-6.0.3
make
make prefix=/usr/local/redis install
5、修改redis.conf以daemon執行
[root@vm-55fbfec9-2204-4954-90b1-67271ee7c4b0 bin]# grep daemon redis.conf
daemonize yes
6、啟動redis
./redis-server redis.conf
./redis-cli
[root@vm-55fbfec9-2204-4954-90b1-67271ee7c4b0 bin]# redis-cli
127.0.0.1:6379> ping
pong
安裝redis集群
#建立配置檔案
[root@vm-55fbfec9-2204-4954-90b1-67271ee7c4b0 kconfig]# cat redis6380.conf
include /usr/local/bin/kconfig/redis.conf
pidfile "/var/run/redis6380.pid"
port 6380
dbfilename "dump6380.rdb"
cluster-enabled yes
cluster-config-file node-6380.conf
cluster-node-timeout 15000
#啟動6個例項
[root@vm-55fbfec9-2204-4954-90b1-67271ee7c4b0 kconfig]# ps -ef|grep redis
root 31911 1 0 11:10 ? 00:00:02 redis-server 127.0.0.1:6380 [cluster]
root 31938 1 0 11:10 ? 00:00:02 redis-server 127.0.0.1:6381 [cluster]
root 31974 1 0 11:10 ? 00:00:02 redis-server 127.0.0.1:6382 [cluster]
root 32012 1 0 11:10 ? 00:00:02 redis-server 127.0.0.1:6390 [cluster]
root 32050 1 0 11:10 ? 00:00:02 redis-server 127.0.0.1:6391 [cluster]
root 32062 1 0 11:11 ? 00:00:02 redis-server 127.0.0.1:6392 [cluster]
#建立集群
redis-cli --cluster create 127.0.0.1:6380 127.0.0.1:6381 127.0.0.1:6382 127.0.0.1:6390 127.0.0.1:6391 127.0.0.1:6392 --cluster-replicas 1
#檢視集群狀態
[root@vm-55fbfec9-2204-4954-90b1-67271ee7c4b0 kconfig]# redis-cli -c -p 6380
127.0.0.1:6380> cluster nodes
9467d8a87b935deb57875689fccd4a22f5b44209 127.0.0.1:6391@16391 sl**e e59e4511ef9e2816c1a1fe8c89c17f4f8de5ae53 0 1595778201000 3 connected
43bebe3e0646119264ae865e508dfa5bfcedef36 127.0.0.1:6392@16392 sl**e 9e90af4a5f76f6d007a3e002285307286d17f5a6 0 1595778203817 1 connected
3926c5da0c5f32a114242ba1a4649d564af960ef 127.0.0.1:6390@16390 sl**e 353af028076bff70ebb69f9e9fb6cc057a1302e4 0 1595778202000 2 connected
e59e4511ef9e2816c1a1fe8c89c17f4f8de5ae53 127.0.0.1:6382@16382 master - 0 1595778202814 3 connected 10923-16383
9e90af4a5f76f6d007a3e002285307286d17f5a6 127.0.0.1:6380@16380 myself,master - 0 1595778203000 1 connected 0-5460
353af028076bff70ebb69f9e9fb6cc057a1302e4 127.0.0.1:6381@16381 master - 0 1595778201000 2 connected 5461-10922
Centos 7 搭建 Redis 單節點集群
yum y install gcc automake autoconf libtool maketar zxvf redis 5.0.0.tar.gz cd redis 5.0.0 make make install mkdir redis cluster cd redis cluster mkdi...
搭建ceph集群(單節點)
軟體環境 centos7 x64 ceph版本 ceph deploy v1.5.37 ceph version 10.2.9 步驟1.修改主機名 即節點名 1 sed i hostname d etc sysconfig network echo hostname 主機名 etc sysconfi...
redis 單台服務集群搭建
參考 mkdir cluster redis mkdir 12000 mkdir 13000 mkdir 14000 mkdir 15000 mkdir 16000 mkdir 17000 每個12000 13000等目錄下再建立 mkdir data mkdir logs mkdir pid mk...