CentOs7.9にredis6.2.6をインストールする方法

環境
CentOS Linux release 7.9.2009 (Core)
redis 6.2.6

操作方法
1.remiレポジトリをインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# sudo rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

2.redisをインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo yum --enablerepo=remi install redis
# sudo yum --enablerepo=remi install redis
# sudo yum --enablerepo=remi install redis

3.redisのバージョンを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# redis-server -v
Redis server v=6.2.6 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=4ab9a06393930489
# redis-server -v Redis server v=6.2.6 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=4ab9a06393930489
# redis-server -v
Redis server v=6.2.6 sha=00000000:0 malloc=jemalloc-5.1.0 bits=64 build=4ab9a06393930489

4.redis動作を確認します

4.1 keyを作成します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# redis-cli
127.0.0.1:6379> set keyA "tokyo"
OK
keyを取得します
127.0.0.1:6379> get keyA
"tokyo"
# redis-cli 127.0.0.1:6379> set keyA "tokyo" OK keyを取得します 127.0.0.1:6379> get keyA "tokyo"
# redis-cli
127.0.0.1:6379> set keyA "tokyo"
OK
keyを取得します
127.0.0.1:6379> get keyA
"tokyo"

4.2 keyを削除します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
127.0.0.1:6379> del keyA
(integer) 1
127.0.0.1:6379> get keyA
(nil)
127.0.0.1:6379> exit
127.0.0.1:6379> del keyA (integer) 1 127.0.0.1:6379> get keyA (nil) 127.0.0.1:6379> exit
127.0.0.1:6379> del keyA
(integer) 1
127.0.0.1:6379> get keyA
(nil)
127.0.0.1:6379> exit

5.redis再起動

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo systemctl restart redis
# sudo systemctl restart redis
# sudo systemctl restart redis

redis停止

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo systemctl stop redis
# sudo systemctl stop redis
# sudo systemctl stop redis

redis起動

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo systemctl start redis
# sudo systemctl start redis
# sudo systemctl start redis

ログを確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# sudo journalctl -r -u redis
# sudo journalctl -r -u redis
# sudo journalctl -r -u redis

 

CentOS 7

Posted by arkgame