Linux installation Redis Full process log

Source: Internet
Author: User
Tags redis server

wget http://download.redis.io/redis-stable.tar.gz
Tar xvzf redis-stable.tar.gz
CD redis-stable
Make

The first 3 steps should be no problem, the main problem is that when you execute make, an exception occurs.
Exception One:
MAKE[2]: Cc:command not found
Exception reason: GCC is not installed
Solution: Yum Install gcc-c++
Exception Two:
Zmalloc.h:51:31:error:jemalloc/jemalloc.h:no such file or directory
Exception reason: Some compiler dependencies or original compilation legacy problems
Solution: Make Distclean. Clean it up and make it again.


After make is successful, make test is required. An exception occurred in make test.
Exception One:
Couldn ' t execute "tclsh8.5": No such file or directory
Exception reason: Tcl not installed
Solution: Yum install-y tcl.

After make succeeds, there are some more executables in the SRC directory: Redis-server,redis-cli and so on.


During the convenient period, the CP command is copied to the USR directory for operation.
CP redis-server/usr/local/bin/
CP redis-cli/usr/local/bin/


Then create a new directory, store the configuration file
Mkdir/etc/redis
Mkdir/var/redis
Mkdir/var/redis/log
Mkdir/var/redis/run
mkdir/var/redis/6379


Locate the profile template in the Redis solution directory and copy it to the following location.
CP redis.conf/etc/redis/6379.conf
Modify with vim command
Daemonize Yes
Pidfile/var/redis/run/redis_6379.pid
Logfile/var/redis/log/redis_6379.log
dir/var/redis/6379
Finally, run Redis:
$ redis-server/etc/redis/6379.conf
################################ #开机自启动配置 #################################
#!/bin/sh
#
# chkconfig:2345 90 10
# Description:redis is a persistent key-value database
# redis Startup script for Redis processes
# Processname:redis
Redis_path= "/usr/local/bin/redis-server"
redis_conf= "/etc/redis/6379.conf"
Redis_pid= "/var/redis/run/redis_6379.pid"
# Source function library.
. /etc/rc.d/init.d/functions
[-X $redis _path] | | Exit 0
Retval=0
Prog= "Redis"
# Start Daemons.
Start () {
If [-e $redis _pid-a!-Z $redis _pid];then
Echo $prog "already running ..."
Exit 1
Fi
Echo-n $ "Starting $prog"
# Instance for all caches
$redis _path $redis _conf
Retval=$?
[$RETVAL-eq 0] && {
touch/var/lock/subsys/$prog
Success $ "$prog"
}
Echo
Return $RETVAL
}
# Stop Daemons.
Stop () {
Echo-n $ "Stopping $prog"
killproc-d $redis _path
Echo
[$RETVAL = 0] && rm-f $redis _pid/var/lock/subsys/$prog
Retval=$?
Return $RETVAL
}
# See how we were called.
Case "$" in
Start
Start
;;
Stop
Stop
;;
Status
Status $prog
Retval=$?
;;
Restart
Stop
Start
;;
Condrestart)
if test "x ' pidof redis '"! = x; Then
Stop
Start
Fi
;;
*)
echo $ "Usage: $ {Start|stop|status|restart|condrestart}"
Exit 1
Esac
Exit $RETVAL
-------------------------------------------------------
: wq! #保存退出
chmod 755/etc/init.d/redis #添加脚本执行权限
Chkconfig--add Redis #添加开启启动
Chkconfig--level 2345 Redis on #设置启动级别
Chkconfig--list Redis #查看启动级别
Service Redis Restart #重新启动redis
################################ #设置redis配置文件参数 ##############################
Mkdir-p/usr/local/redis/var #创建redis数据库存放目录
Vim/etc/redis/6370.conf


Daemonize Yes #以后台daemon方式运行redis
Pidfile "/var/run/redis.pid" #redis以后台运行, default PID file path/var/run/redis.pid
Port 6379 #默认端口
Bind 127.0.0.1 #默认绑定本机所有ip地址, in order to be safe, can only listen to intranet IP
Timeout #客户端超时设置, unit of seconds
LogLevel verbose #设置日志级别, supports four levels: debug, notice, verbose, warning
LogFile stdout #日志记录方式, default to standard output, logs not write file, output to empty device/deb/null
LogFile "/usr/local/redis/var/redis.log" #可以指定日志文件路径
Databases #开启数据库的数量
Save 900 1
Save 300 10
Save 60 10000
Create a local database snapshot, format: Save * *
1 write operations in 900 seconds
10 write operations in 300 seconds
10,000 write operations in 60 seconds
Rdbcompression Yes #启用数据库lzf压缩, can also be set to No
Dbfilename Dump.rdb #本地快照数据库名称
Dir "/usr/local/redis/var/" #本地快照数据库存放目录
Requirepass 123456 #设置redis数据库连接密码
MaxClients 10000 #同一时间最大客户端连接数, 0 for unrestricted
MaxMemory 1024MB #设定redis最大使用内存, the value is less than the physical memory and must be set
AppendOnly Yes #开启日志记录, equivalent to MySQL's Binlog
Appendfilename "Appendonly.aof" #日志文件名, note: Not a directory path
Appendfsync everysec #每秒执行同步, there are two parameters always, no is generally set to everysec, the equivalent of the MySQL thing log writing method
: wq! #保存退出
Service Redis Restart #重启
################################### #测试redis数据库 ####################################
Redis-cli-a 123456 #连接redis数据库, note:-A followed by a Redis database password
Set name 111cn.net #写数据
Get name #读取数据
Exit #退出redis数据库控制台
Redis-benchmark-h 127.0.0.1-p 6379-c 1000-n 100000 #1000个并发连接, 100,000 requests, testing Redis server performance with 127.0.0.1 Port 6379


Linux installation Redis Full process log

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.