Centos 6.3 기준 설치 스크립트.
// 1. redis 다운로드 wget https://redis.googlecode.com/files/redis-2.6.7.tar.gz // 2. 압축해제 및 make tar -xvzf redis-2.6.7.tar.gz cd redis-2.4.16 make // 3.특정경로로 바이너리 설치시 make PREFIX=/srv/redis install // 4.conf 파일 복사 압축해제시, 샘플 conf 및 utls 경로 참조 cp /srv/src/redis-2.6.7/redis.conf /srv/redis/conf/6379.conf vi /etc/init.d/redis_6379 #!/bin/sh # chkconfig: - 85 15 # # Simple Redis init.d script conceived to work on Linux systems # as it does use of the /proc filesystem. REDISPORT=6379 EXEC=/srv/redis/bin/redis-server CLIEXEC=/srv/redis/bin/redis-cli PIDFILE=/srv/redis/run/redis_${REDISPORT}.pid CONF="/srv/redis/conf/${REDISPORT}.conf" case "$1" in start) if [ -f $PIDFILE ] then echo "$PIDFILE exists, process is already running or crashed" else echo "Starting Redis server..." $EXEC $CONF fi ;; stop) if [ ! -f $PIDFILE ] then echo "$PIDFILE does not exist, process is not running" else PID=$(cat $PIDFILE) echo "Stopping ..." $CLIEXEC -p $REDISPORT shutdown while [ -x /proc/${PID} ] do echo "Waiting for Redis to shutdown ..." sleep 1 done echo "Redis stopped" fi ;; *) echo "Please use start or stop as first argument" ;; esac chmod +x /etc/init.d/redis_6379 chkconfig --add redis_6379 chkconfig redis_6379 on chkconfig --list // 5.1 service 로 실행 service redis_6379 start // 5-2. 실행 (src 혹은 install 시 bin 경로에서) redis-server // 참고:configuration 파일 지정 실행 redis-server /파일/경로/redis.conf // 5. 필요시 포트 개방 iptables -I INPUT -p tcp --dport 6379 -j ACCEPT service iptables save service iptables restart // 6. client 프로그램으로 테스트 redis-cli redis> set foo bar OK redis> get foo "bar" // 기타 # 데몬실행 필요시 6379.conf 에서 daemonize yes # 필요시 /etc/sysctl.conf 에 vm.overcommit_memory = 1 추가가참고 http://redis.io/