1.redis Simple Description
A. In the previous I simply said that the Redis package is implemented as a common class, with the following address: http://www.cnblogs.com/hanyinglong/p/Redis.html.
B.redis is a key-value storage system that supports the storage of value types compared memcached more, including string,list,set,sets,hashes, etc. (It supports data Structures such as strings,hashes,lists,sets,sorted sets with range Queries,bitmaps,hyperloglogs and geospatial indexes W ITH radius queies) These data types support rich operations such as Push/pop,add/remove, and these operations are atomic in nature. C.redis and memcached, in order to ensure efficiency, data is cached in memory, the difference is that Redis periodically writes updated data to disk, and can implement Master-slave (Master-slave) synchronization. D.redis in data storage, using the idea of a NoSQL database, the key as a unique indicator of data retrieval, it can be easily understood as a relational database index key, and value as the main object of data storage, where each value has a key corresponding to the Redi s, value will be treated as a binary byte stream used to store data in any format, such as Json,xml, picture and byte streams of serialized objects, so we can also think of it as a blob type field in an RDB so that when we do a data query, we can only base our query on key. E.redis official website: http://www.redis.io/2. Preparatory work
A. Through the above instructions we can both start to install Redis under the Linux system, in the process of installing Redis I encountered some problems, but also all resolved, originally I would like to write directly and then encountered the error in the lead up to need to install what, but not very good to write, so I still in front of these software ready, everyone installed When you can install Redis to verify that there will be problems, the solution is OK.
b. Download the Redis package: http://download.redis.io/releases/redis-3.0.5.tar.gzC.redis is implemented in the C language, so you need to install GCC in Linux system to compile, please refer to the third step for installing GCC. D. The next need to install the UNIX TCL tool, if not installed later we will not be able to test Redis, after the installation of make test error, install TCL please refer to the 4th step, TCL package is:/http Downloads.sourceforge.net/tcl/tcl8.6.3-src.tar.gzE. After installing the required packages above, you can install Redis, please refer to the 5th step. F. The required software and system are as follows: Virtual machine (Vmware), CentOS system installed in virtual machine, Xshell,xftp,redis package, TCL package. installation of 3.GCC
A. With the above preparation, we now have an environment that can be installed and released, and if not, check the installation yourself.
B. Install gcc under CentOS, we install with Yum (Package manager) because GCC relies on a lot of things, and some package systems may already be installed, some of them are not, so the following commands are executed at the end and execute the following command in Xshell:b.1 Yum Install CPPb.2 Yum Install binutilsb.3 Yum Install glibc-kernheadersb.4 Yum Install Glibc-commonb.5 Yum Install glibc-develb.6 Yum Install gccb.7 Yum Install makeNote: All of the above package information will be prompted when the installation is complete, if it is not completed, but nothing to do, then the server has installed this package, do not need to install again, so it doesn't matter, continue to execute the next command. C. If there is no error during installation, the installation of GCC is complete and TCL is installed below. installation of 4.TCL
A. In Xshell, use the command to jump to local to create your own folder: Kencery
A.1 CD usr/local/mkdir kencery CD kencery/B. Then use XFTP to copy the TCL package to the Kencery folder under the ready-to-Work download: c. Unzip the uploaded TCL package and rename it to Tcl after decompression.C.1 TAR-ZXVF tcl8.6.3-src.tar.gzC.2 MV tcl8.6.3 tclC.3 CD tclD. Use the following command to install after the decompression is complete, the order of command execution according to my written. D.1 CD unix/D.2./configureD.3 MakeD.4 make installE. In the process of execution if there is no error, wait patiently, these commands are not placed here, according to the order I wrote. installation of 5.redis
A. With the steps above, the preparation is complete, and Redis is ready to begin installation.
B. Use xftp to copy the Redis package downloaded under preparation to the Kencery folder: c. Unzip the uploaded Redis package and rename it to Redis after decompression:C.1 TAR-ZXVF redis-3.0.5.tar.gzC.2 MV redis-3.0.5 RedisC.3 CD RedisD. Once the package has been unzipped, it can be installed and the command is installed (performed under Redis directory):D.1 Make(1) in the practice of typing make error, but now write blog when the deployment does not appear error, if there is an error, please use this command (made MALLOC=LIBC) can be executed, because there is no error, so no, if you encounter words to me, thank you. (2) If execute make has an error, and when you execute make again, we recommend that you clean it up in execution, and the command is: make. D.2 CD Src/make Test(1) After you have finished making, the final program will output (t ' a good idea to run ' make test '), it is recommended that we perform the test by making test, then we will enter makes test, check the test, whether there is a question If it appears: The test does not have a problem: (2) When I enter make test execution, I will be wrong when I practice, but this error does not affect our test, so we can ignore it. D.3 make installThe final implementation of make install, without errors, indicates that the Redis installation was successful: test of 6.redisA. After you install Redis, you need to test, and here's a simple test to verify that our Redis installation is successful. B. First we start the Redis service and start and close the Redis Service command as follows:B.1 Src/redis-server & Start Redis, plus & means Redis is running in daemon modeB.2 redis-server/usr/local/kencery/redis/redis.conf start Redisb.3 src/redis-cli shutdown turn off Redisb.4 Enter the command to start Redis and start Redis: b.5 after Redis boot is complete, use NETSTAT-NTLP |grep 6379 to see if the port is in use and if it is in use, the installation is successful or the installation is unsuccessful. b.6 Connect Redis and test, Connection command for: SRC/REDIS-CLI, final Test result: b.7 to here Reids installation and testing work is complete. server startup and shutdown for Redis set up in 7.Linux
A. As mentioned above, we have completed the installation of Redis, and then we can follow the above methods, but there are still some small problems, that is, after the Linux system restarts need to find the installation path to execute the boot command, then we can set the form of service to start Redis?
B. Execute command: Vim/etc/init.d/redi, create a script file, write the following code in the file, save and exit:
1# Date -- A-Ten 2# Chkconfig:2345 Ten - 3# Description:start and Stop Redis4 5path=/usr/local/kencery/redis/src:/sbin:/usr/bin:/bin6redisport=6379 7exec=/usr/local/kencery/redis/src/redis-Server8redis_cli=/usr/local/kencery/redis/src/redis-CLI9 Tenpidfile=/var/run/Redis.pid Oneconf="/usr/local/kencery/redis/redis.conf" AAuth="1234" - Case " $" inch -start) the if[ -F $PIDFILE] - Then - Echo "$PIDFILE exists, process is already running or crashed." - Else + Echo "starting Redis Server ..." -$EXEC $CONF + fi A if["$?"="0" ] at Then - Echo "Redis is running ..." - fi - ;; -stop) - if[-F $PIDFILE] in Then - Echo "$PIDFILE exists, process is not running." to Else +pid=$ (Cat$PIDFILE) - Echo "stopping ..." the$REDIS _CLI-P $REDISPORT SHUTDOWN * Sleep 2 $ while[ -x $PIDFILE]Panax Notoginseng Do - Echo "waiting for Redis to shutdown ..." the Sleep 1 + Done A Echo "Redis stopped" the fi + ;; -restart|force-Reload) $${0} Stop $${0} start - ;; -*) the Echo "Usage:/etc/init.d/redis {start|stop|restart|force-reload}">&2 -Exit1 Wuyi Esac
View Code
C. Add permissions to the file, using a script file can be executed, the command is: chmod 755/etc/init.d/redis
D. The above work successfully completed and no error occurred, the configuration is complete, each time we turn on the following two commands can be entered to start and close the Redis service:D.1 Service Redis start to turn on Redis servicesD.2 service Redis stop off Redis services F. When the service is turned on, you can either connect to the Redis test or use another client to operate Redis, testing:
set up Redis's boot boot in 8.Linux
A. In most cases, we need to automatically turn on Redis when the server restarts, not when we manually turn it on, so let's say the startup auto-start setting.
B. First set the daemonize in Redis.config to Yes to ensure that the daemon is turned on and execute the following command:B.1 CD Usr/local/kencery/redisb.2 vim redis.conf Open config file, find daemonize attribute wine set to Yes, save and exit. c. Then set the boot up command: Chkconfig redis onD. When the above steps are complete, you can restart Linux and follow the previous test to start automatically with the machine.
transferred from: Http://www.cnblogs.com/hanyinglong/p/5036558.html#_label1
Linux (Centos) installation Redis and considerations