Redis Startup Process

Source: Internet
Author: User
Tags redis server

There are two types of redis startup: development environment and production environment.

I. Development Environment

1. CD redis-2.8.13/src

2../redis-Server start the server

3.../redis-cli start the client

Ii. Production Environment (started with the System)

1. Configure the redis initialization script (sample in/redis-2.8.13/utils/) and put it under/etc/init. d/(named redis_6379)

#! /Bin/sh

#

# Simple redis init. d script conceived to work on Linux systems

# As it does use of the/proc filesystem.


Redisport = 6379

Exec =/usr/local/bin/redis-Server

Cliexec =/usr/local/bin/redis-cli


Pidfile =/var/run/redis _ $ {redisport}. PID

Conf = "/etc/redis/$ {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

How to modify the initialization script file: Modify the port number of the redis server to listen to: 6379 (default)

 

2. Create a directory in the/etc directory:/etc/redis and/var/redis/6379, and store the corresponding files.

1,/etc/redis/storage configuration file, named 62.16.cof (template in the source code directory/redis-2.8.13 /)

EDIS configuration file example

Daemonize no // change to yes to enable redis to start in daemonize Mode

Pidfile/var/run/redis. PID // modify it to/var/run/redis_62.16.pid to set the path of the redis PID File

Port 6379 // change to 6379 listening port number

Timeout 0

Loglevel notice

Logfile ""

Databases 16

Save 900 1

Save 300 10

Save 60 10000

Stop-writes-on-bgsave-error Yes

Rdbcompression Yes

Rdbchecksum Yes

Dbfilename dump. RDB

Dir. // change to/var/redis/6379 to set the path of the persistent file.

Slave-serve-stale-data Yes

Slave-read-only yes

Repl-Disable-TCP-nodelay No

Slave-priority 100

Appendonly No

Appendfilename "appendonly. aof"

Appendfsync everysec

No-appendfsync-on-Rewrite No

Auto-Aof-rewrite-percentage 100

Auto-Aof-rewrite-Min-size 64 MB

Lua-time-limit 5000

Slowlog-max-len 128

Latency-monitor-threshold 0

Policy-keyspace-events ""

Hash-max-ziplist-entries 512

Hash-max-ziplist-value 64

List-max-ziplist-entries 512

List-max-ziplist-value 64

Set-max-intset-entries 512

Zset-max-ziplist-entries 128

Zset-max-ziplist-value 64

Hll-Sparse-max-bytes 3000

Activerehashing Yes

Client-output-buffer-limit normal 0 0 0

Client-output-buffer-limit slave 256 MB 64 MB 60

Client-output-buffer-limit pubsub 32 MB 8 Mb 60

Hz 10

Aof-rewrite-incremental-fsync Yes


2. store persistent files in the/var/redis/port number directory (when this component is used)

3. sudo update-rc.d redis_6379 defaults (configure the random start command redis_6379 to initialize the script file)


Redis Startup Process

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.