Skip to content

Instantly share code, notes, and snippets.

@Asuforce
Created March 8, 2023 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Asuforce/c0a53cee53dd6b082e3c1252d919b193 to your computer and use it in GitHub Desktop.
Save Asuforce/c0a53cee53dd6b082e3c1252d919b193 to your computer and use it in GitHub Desktop.

Redis 構築

基本の構築

centos 7.6 に redis を構築します

# Update package list
$ sudo yum update -y

# Install redis
$ sudo yum install -y redis

# Show redis.service
$ $ cat /usr/lib/systemd/system/redis.service
[Unit]
Description=Redis persistent key-value database
After=network.target
After=network-online.target
Wants=network-online.target

[Service]
ExecStart=/usr/bin/redis-server /etc/redis.conf --supervised systemd
ExecStop=/usr/libexec/redis-shutdown
Type=notify
User=redis
Group=redis
RuntimeDirectory=redis
RuntimeDirectoryMode=0755

[Install]
WantedBy=multi-user.target

# Start redis
$ sudo systemctl start redis

# ping
$ redis-cli -p 6379
127.0.0.1:6379> ping
PONG

認証を追加

$ sudo vi /etc/redis.conf
requirepass <password>

$ sudo systemctl restart redis

$ redis-cli
127.0.0.1:6379> AUTH <password>
OK
127.0.0.1:6379> ping
PONG

参考

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment