Pages

2013年3月12日火曜日

Redisを入れてみた

今回入れたサーバーは CentOS 5.8 32bit です。


$ su -
# cd /usr/local/src
# wget http://download.redis.io/redis-stable.tar.gz
# tar zxvf redis-stable.tar.gz
# cd redis-stable
# make

CC sentinel.o
LINK redis-server
zmalloc.o: In function `zmalloc_used_memory':
/usr/local/src/redis-stable/src/zmalloc.c:223: undefined reference to `__sync_add_and_fetch_4'
collect2: ld returned 1 exit status
make[1]: *** [redis-server] Error 1
make[1]: Leaving directory `/usr/local/src/redis-stable/src'
make: *** [all] Error 2
こんなエラーで中断
一先ず
# make clean

http://stackoverflow.com/questions/13472631/redis-installation-error-on-centos-5-8
を参考に

# cd src
# vi Makefile

-----
$(MAKE) CFLAGS="-m32" LDFLAGS="-m32"
-----

-----
$(MAKE) CFLAGS="-m32 -march=i686" LDFLAGS="-m32"
-----
に修正

続いて
# vi .make-settings

-----
OPT=-O2
-----

-----
OPT=-O2 -march=i686
-----
に修正

# cd ..
# make 32bit
# make test

tcl8.5が必要ってエラー出るのでテストはやめて

# make install

動作確認
redis-server
これでサーバを起動

起動させたまま、別のターミナルで
$ redis-cli
$ redis> ping
PONG
$ redis> set foo bar
OK
$ redis> get foo
"bar"
$ redis> quit

自動起動の設定
# cd /usr/local/src/redis-stable/utils
# ./install_server.sh

全部デフォルトで

Please select the redis port for this instance: [6379]
Selecting default: 6379
Please select the redis config file name [/etc/redis/6379.conf]
Selected default - /etc/redis/6379.conf
Please select the redis log file name [/var/log/redis_6379.log]
Selected default - /var/log/redis_6379.log
Please select the data directory for this instance [/var/lib/redis/6379]
Selected default - /var/lib/redis/6379
Please select the redis executable path [/usr/local/bin/redis-server]
s#^port [0-9]{4}$#port 6379#;s#^logfile .+$#logfile /var/log/redis_6379.log#;s#^dir .+$#dir /var/lib/redis/6379#;s#^pidfile .+$#pidfile /var/run/redis_6379.pid#;s#^daemonize no$#daemonize yes#;
which: no chkconfig in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/goontic/bin)
Copied /tmp/6379.conf => /etc/init.d/redis_6379
Installing service...
which: no chkconfig in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/goontic/bin)
./install_server.sh: line 178: update-rc.d: command not found
 exists, process is already running or crashed
Installation successful!

# vi /etc/init.d/redis_6379

何故か上の方の改行がおかしかったので、修正して

2行目に下記を追加
-----
# chkconfig:    345     80      20
# description: anything
-----

-----

#/bin/sh
# chkconfig:    345     80      20
# description: anything

#Configurations injected by install_server below....

EXEC=/usr/local/bin/redis-server
CLIEXEC=/usr/local/bin/redis-cli
PIDFILE=/var/run/redis_6379.pid
CONF="/etc/redis/6379.conf"

REDISPORT="6379"

###############

-----

# service redis_6379 start

# chkconfig redis_6379 on

0 件のコメント:

コメントを投稿

Followers