Logs of the entire process of installing Redis in Linux
Wget http://download.redis.io/redis-stable.tar.gz
Tar xvzf redis-stable.tar.gz
Cd redis-stable
Make
There should be no problem in the previous three steps. The main problem is that an exception occurs when you execute make.
Exception 1:
Make [2]: cc: Command not found
Cause of exception: gcc Is Not Installed
Solution: yum install gcc-c ++
Exception 2:
Zmalloc. h: 51: 31: error: jemalloc/jemalloc. h: No such file or directory
Cause of exception: Some compilation dependencies or issues left behind by the original compilation
Solution: make distclean. Clean up and then make.
Make test is required after make is successful. An exception occurred in make test.
Exception 1:
Couldn't execute "tclsh8.5": no such file or directory
Cause of exception: tcl is not installed
Solution: yum install-y tcl.
After make is successful, some executable files will be added to the src directory: redis-server, redis-cli, and so on.
During this period, copy the cp command to the usr directory and run it.
Cp redis-server/usr/local/bin/
Cp redis-cli/usr/local/bin/
Create a directory to store the configuration file.
Mkdir/etc/redis
Mkdir/var/redis
Mkdir/var/redis/log
Mkdir/var/redis/run
Mkdir/var/apsaradb for redis/6379
Find the configuration file template in the redis root directory and copy it to the following location.
Cp redis. conf/etc/redis/6379. conf
Use the vim command to modify
Daemonize yespidfile/var/redis/run/redis_62.16.pidlogfile/var/redis/log/redis_62.16.logdir/var/redis/6379 last run redis: $ redis-server/etc/redis/6379. conf ################################# Automatic startup configuration ### ###############################! /Bin/sh # chkconfig: 2345 90 10 # description: Redis is a persistent key-value database # redis Startup script for redis processes # processname: redisredis_path = "/usr/local/bin/apsaradb for redis-server" redis_conf = "/etc/redis/6379. conf "redis_pid ="/var/redis/run/redis_62.16.pid "# Source function library .. /etc/rc. d/init. d/functions [-x $ redis_path] | exit 0 RETVAL = 0 prog = "redis" # Start daemons. start () {if [-e $ red Is_pid-! -Z $ redis_pid]; thenecho $ prog "already running .... "exit 1 fiecho-n $" Starting $ prog "# Single instance for all caches $ redis_path $ redis_confRETVAL =$? [$ RETVAL-eq 0] & {touch/var/lock/subsys/$ progsuccess $ "$ prog"} echoreturn $ RETVAL} # Stop daemons. stop () {echo-n $ "Stopping $ prog" killproc-d 10 $ redis_pathecho [$ RETVAL = 0] & rm-f $ redis_pid/var/lock/subsys/$ progRETVAL = $? Return $ RETVAL} # See how we were called. case "$1" instart) start; stop) stop; status) status $ progRETVAL =$ ?;; Restart) stopstart; condrestart) if test "x 'pidof redis '"! = X; thenstopstartfi; *) echo $ "Usage: $0 {start | stop | status | restart | condrestart}" exit 1 esacexit $ RETVAL restart: wq! # Save and exit chmod 755/etc/init. d/redis # add the script execution permission chkconfig -- add redis # add enable chkconfig -- level 2345 redis on # Set the startup level chkconfig -- list redis # view the startup level service redis restart # restart redis ################################# set redis configuration file parameters # ############################ mkdir-p/usr/local/redis/var # create the redis database storage directory vim/etc/redis/6370. confdaemonize yes # run redispidfile in daemon mode "/var/run/redis. pid "# Run on apsaradb for redis later. Default pid file path /Var/run/redis. pidport 6379 # default port bind 127.0.0.1 # All IP addresses of the local machine are bound by default. To ensure security, you can only listen to intranet iptimeout 300 # Set the client timeout, in the unit of second loglevel verbose # Set the log level, four levels are supported: debug, notice, verbose, warninglogfile stdout # log record mode. The default value is standard output, and logs does not write files, output to the empty device/deb/nulllogfile "/usr/local/redis/var/redis. log "# You can specify the log file path databases 16 # number of databases enabled save 900 1 save 300 10 save 60 10000 create a local database snapshot in the format of save ** 900 seconds, 1 write operation: within 300 seconds, 10 write operations within 60 seconds, and 10000 write operations rdbcompressi On yes # enable lzf compression, or set it to nodbfilename dump. rdb # local snapshot database name dir "/usr/local/redis/var/" # local snapshot database storage directory requirepass 123456 # Set the redis database connection password maxclients 10000 # maximum number of client connections at the same time, 0 is unrestricted maxmemory 1024 MB # Set redis maximum memory usage, the value must be smaller than the physical memory, appendonly yes # Enable logging, equivalent to MySQL binlogappendfilename "appendonly. aof "# log file name. Note: it is not the directory path appendfsync everysec # synchronization is executed per second. Two other parameters always and no are generally set to everysec, which is equivalent to the write method of MySQL transaction logs: wq! # Save and exit service redis restart # restart ################################ #### test the redis database ################################# ### redis-cli-a 123456 # connect to the redis database, note: -a followed by the redis database password set name 111cn.net # write data get name # Read data exit # exit redis Database Console-benchmark-h 127.0.0.1-p 6379-c 1000-n 100000 #1000 concurrent connections, 100000 requests to test the performance of the redis server with 127.0.0.1 port 6379