Fedora 36にRedisをインストールする
環境
OSバージョンを確認します
# cat /etc/redhat-release
Fedora release 36 (Thirty Six)
# cat /etc/redhat-release
Fedora release 36 (Thirty Six)
# cat /etc/redhat-release Fedora release 36 (Thirty Six)
Redisのインストール手順
1.システムパッケージを更新します
# sudo dnf upgrade --refresh
# sudo dnf upgrade --refresh
# sudo dnf upgrade --refresh
2.Redisをインストールします
# sudo dnf install redis -y
# sudo dnf install redis -y
# sudo dnf install redis -y
redisを起動します
# systemctl start redis
# systemctl start redis
# systemctl start redis
redisのスタータスを確認します
# systemctl status redis
● redis.service - Redis persistent key-value database
Loaded: loaded (/usr/lib/systemd/system/redis.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/redis.service.d
mqlimit.conf
Active: active (running) since Sun 2022-05-22 08:27:52 JST; 1s ago
# systemctl status redis
● redis.service - Redis persistent key-value database
Loaded: loaded (/usr/lib/systemd/system/redis.service; disabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/redis.service.d
mqlimit.conf
Active: active (running) since Sun 2022-05-22 08:27:52 JST; 1s ago
# systemctl status redis ● redis.service - Redis persistent key-value database Loaded: loaded (/usr/lib/systemd/system/redis.service; disabled; vendor preset: disabled) Drop-In: /etc/systemd/system/redis.service.d mqlimit.conf Active: active (running) since Sun 2022-05-22 08:27:52 JST; 1s ago
3.redisのプロセスを確認します
# ps -ef | grep redis
redis 14846 1 0 08:27 ? 00:00:00 /usr/bin/redis-server 127.0.0.1:6379
root 14855 4531 0 08:29 pts/1 00:00:00 grep --color=auto redis
# ps -ef | grep redis
redis 14846 1 0 08:27 ? 00:00:00 /usr/bin/redis-server 127.0.0.1:6379
root 14855 4531 0 08:29 pts/1 00:00:00 grep --color=auto redis
# ps -ef | grep redis redis 14846 1 0 08:27 ? 00:00:00 /usr/bin/redis-server 127.0.0.1:6379 root 14855 4531 0 08:29 pts/1 00:00:00 grep --color=auto redis
4.redisサーバーに接続します
# redis-cli
127.0.0.1:6379>
127.0.0.1:6379> set keyA tokyo
OK
127.0.0.1:6379> get keyA
"tokyo"
# redis-cli
127.0.0.1:6379>
127.0.0.1:6379> set keyA tokyo
OK
127.0.0.1:6379> get keyA
"tokyo"
# redis-cli 127.0.0.1:6379> 127.0.0.1:6379> set keyA tokyo OK 127.0.0.1:6379> get keyA "tokyo"
pingを実行します
127.0.0.1:6379> ping
PONG
redisインスタンスを終了します
127.0.0.1:6379> exit
5.Redisの配置ファイルを設定します
# sudo vi /etc/redis.conf
Maxメモリを設定します
以下の内容を編集します
maxmemory 500mb
maxmemory-policy allkeys-lru
maxmemory 500mb
maxmemory-policy allkeys-lru
maxmemory 500mb maxmemory-policy allkeys-lru
ネットワークアクセス構成を設定します
bind 0.0.0.0/0
6.Redisのファイアウォールを設定します
# sudo firewall-cmd --permanent --new-zone=redis
success
# sudo firewall-cmd --reload
success
# sudo firewall-cmd --permanent --new-zone=redis
success
# sudo firewall-cmd --reload
success
# sudo firewall-cmd --permanent --new-zone=redis success # sudo firewall-cmd --reload success