LoginSignup
14
13

More than 3 years have passed since last update.

Redisインストール

Last updated at Posted at 2014-06-14

Redisインストール

ユーザ作成

groupadd -g 1001 redis
useradd -g 1001 -u 1001 -s /sbin/nologin redis

必要なパッケージをインストール

yum install clang make

ダウンロード

cd /usr/local/src/
wget -c http://download.redis.io/releases/redis-5.0.5.tar.gz

インストール

tar zxvf redis-5.0.5.tar.gz
cd redis-5.0.5
CC=clang make && make install

設定

mkdir -p /usr/local/redis/dump
cp -pi redis.conf /usr/local/redis/.
vi /usr/local/redis/redis.conf

その他設定は適宜修正。

/usr/local/redis/redis.conf
158c158
< pidfile /var/run/redis_6379.pid
---
> pidfile /var/run/redis.pid
263c263
< dir ./
---
> dir /usr/local/redis/dump

カーネルパラメータの調整

sysctl vm.overcommit_memory=1
sysctl net.core.somaxconn=1024
vi /etc/sysctl.conf
/etc/sysctl.conf
60a61,63
>
> vm.overcommit_memory = 1
> net.core.somaxconn = 1024

起動

vi /etc/systemd/system/redis.service
/etc/systemd/system/redis.service
[Unit]
Description=redis

[Service]
Type=simple
ExecStart=/usr/local/bin/redis-server /usr/local/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
User=redis
Group=redis
SyslogIdentifier=redis

[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl start redis
systemctl enable redis
14
13
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
14
13