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- is installed based on centos6 source code

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

Share

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

1. Background

The previous chapter introduced memecached installation, this time introduces another star product of NoSQL-> redis.

Many Web applications save the data to RDBMS, where the application server reads the data and displays it in the browser. However, with the increase of the amount of data and the concentration of visits, there will be significant effects, such as the increased burden of REBMS, the deterioration of database response, website display delay and so on. Memcached is a high-performance distributed memory cache server. The purpose of general use is to reduce the number of database visits by caching the query results of the database, so as to improve the speed and expansibility of dynamic Web applications.

* redis has an advantage over memcached

Rich data types: redis supports binary string list hashe set zset storage of five basic data types.

Atomicity: all operations of redis are atomic, and redis also supports atomicity after several operations are merged.

Message subscription: redis supports publish/subscribe.

Persistent data storage: redis supports both Aof and RDB data persistence support.

two。 Environment

4. Install (/ usr/local/src)

Download: wget http://download.redis.io/releases/redis-3.2.8.tar.gz

Decompress: tar zxvf redis-3.2.8.tar.gz

Enter the directory: cd redis-3.2.8

Compile and specify the installation directory: make PREFIX=/usr/local/redis-3.2.8 install

Create a soft link: ln-s / usr/local/redis-3.2.8 / usr/local/redis

5. Configuration file (currently in the redis source directory [/ usr/local/src/redis-3.2.8])

Cp redis.conf / etc/redis.conf

Edit / etc/redis.conf

Daemonize no = > daemonize yes (set redis to background daemon process)

6. Create a redis user

[root@redis-server] # useradd-r-s / sbin/nologin-M redis

7. Create a startup script / etc/init.d/redis

#! / bin/bash## redis- this script starts and stops the redis-server daemon## chkconfig:-80 1 minutes description: Redis is a persistent key-value database# processname: redis-server# config: / usr/local/redis/etc/redis.conf# pidfile: / usr/local/redis/var/redis.pid source / etc/init.d/functions BIN= "/ usr/local/redis/bin" CONFIG= "/ usr/local/redis/etc/redis.conf" PIDFILE= "/ usr/local / redis/var/redis.pid "# Read configuration [- r" $SYSCONFIG "] & & source" $SYSCONFIG "RETVAL=0prog=" redis-server "desc=" Redis Server "start () {if [- e $PIDFILE] Then echo "$desc already running...." Exit 1 fi echo-n $"Starting $desc:" daemon $BIN/$prog $CONFIG RETVAL=$? Echo [$RETVAL-eq 0] & & touch / var/lock/subsys/$prog return $RETVAL} stop () {echo-n $"Stop $desc:" killproc $prog RETVAL=$? Echo [$RETVAL-eq 0] & & rm-f / var/lock/subsys/$prog $PIDFILE return $RETVAL} restart () {stop start} case "$1" in start) start;; stop) stop;; restart) restart;; condrestart) [- e / var/lock/subsys/$prog] & & restart RETVAL=$?;; status) status $prog RETVAL=$?;; *) echo $"Usage: $0 start | stop | restart | condrestart | status}" RETVAL=1esac exit $RETVAL

8. Modify script file permissions

[root@redis-server ~] # chmod 755 / etc/init.d/redis

9. Add to service service management and set boot up

[root@redis-server] # chkconfig-- add redis [root@redis-server ~] # chkconfig redis on

10. Redis service testing

Service redis start

11. Connection test (connection test with its own redis-cli command)

[root@redis-server] # / usr/local/redis/bin/redis-cli-h 127.0.0.1-p 6379

Connection test successful

twelve。 Summary

In order to demand-driven technology, there is no difference in technology itself, only in business.

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