Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Redis stand-alone installation

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

System: CentOS 6.8 64X

Redis version: redis-3.2.5

Download the installation package

# wget http://download.redis.io/releases/redis-3.2.5.tar.gz

Install the packages required for compilation

# yum-y install gcc tcl

Create an installation directory

# mkdir / usr/local/redis

Decompression

# tar xvf redis-3.2.5.tar.gz

Compilation and installation

# cd redis-3.2.5

# make PREFIX=/usr/local/redis/ install

Create configuration files, logs, rdb, pid, startup script directories

# cd / usr/local/redis/

# mkdir log data pid initscript conf

Configure the redis startup script and rename

# cp ~ / redis-3.2.5/utils/redis_init_script / usr/local/redis/initscript/

# cd / usr/local/redis/initscript/

# mv redis_init_script redis

Modify startup script

# vim redis

#! / bin/sh## Simple Redis init.d script conceived towork on Linux systems# as it does use of the / proc filesystem. REDISPORT=6379EXEC=/usr/local/redis/bin/redis-serverCLIEXEC=/usr/local/redis/bin/redis-cli PIDFILE=/usr/local/redis/pid/redis_$ {REDISPORT} .pidCONF = "/ usr/local/redis/conf/$ {REDISPORT} .conf" case "$1" in start) if [- f $PIDFILE] then echo "$PIDFILE exists Processis already running or crashed "else echo" Starting Redisserver... "$EXEC $CONF fi ; stop) if [!-f $PIDFILE] then echo "$PIDFILE does notexist, process is not running" else PID=$ (cat $PIDFILE) echo "Stopping." $CLIEXEC-p $REDISPORT shutdown while [- x / proc/$ {PID}] do echo "Waiting forRedis to shutdown." Sleep 1 done echo "Redis stopped" fi;; *) echo "Please use start or stop as first argument";; esac

Copy the configuration file and modify the redis.conf and rename (consistent with the startup script)

# cp / home/roger/package/redis-3.2.5/redis.conf/usr/local/redis/conf/

# cd / usr/local/redis/conf/

# mv redis.conf 6379.conf

# vim 6379.conf

1. Note the bind parameter # bind 127.0.0.12. Close the protected mode protected-mode no3. Set port prot 63794. Set redis to launch daemonize yes5 in the background. Set the pid file directory pidfile / usr/local/redis/pid/redis_6379.pid6. Set the log file directory logfile "/ usr/local/redis/log/redis_6379.log" 7. Set the rdb file storage name dbfilename dump_6379.rdb8. Set the rdb file storage directory dir / usr/local/redis/data/

Modify the firewall to open port 6379

# vim / etc/sysconfig/iptables

-An INPUT-m state-- state NEW-m tcp- p tcp--dport 6379-j ACCEPT

Restart the firewall

# service iptables restart

Set Redis to environment variable

# vim / etc/profile

Export PATH=$PATH:/usr/local/redis/bin

Make the Redis environment variable effective

# source / etc/profile

Start redis

# / usr/local/redis/initscript/redis start

Pass client verification

# redis-cli-p 6379

Close redis

# / usr/local/redis/initscript/redis stop

Set redis to boot

# vim / etc/rc.local

/ usr/local/redis/initscript/redis start

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report