Golfreeze.packetlove.com: Life style of Golfreeze Canon400D Family kammtan.com Jazz Freebsd Unix Linux System Admin guitar Music
		All about unix linux freebsd and FAQ for Packetlove.com Web hosting , Mail hosting , VoIP + IP PBX server => All about virtualization openstack + vmare esxi => Topic started by: golfreeze on เมษายน 01, 2017, 11:11:22 pm
		
			
			- 
				manage cache session expire ttl ด้วย redis api
 https://www.digitalocean.com/community/tutorials/how-to-install-and-use-redis
 
 About Redis
 
 Redis, developed in 2009, is a flexible, open-source, key value data store. Following in the footsteps of other NoSQL databases, such as Cassandra, CouchDB, and MongoDB, Redis allows the user to store vast amounts of data without the limits of a relational database. Additionally, it has also been compared to memcache and can be used, with its basic elements as a cache with persistence.
 
 Setup
 Before you install redis, there are a couple of prerequisites that need to be downloaded to make the installation as easy as possible.
 
 Start off by updating all of the apt-get packages:
 
 sudo apt-get update
 Once the process finishes, download a compiler with build essential which will help us install Redis from source:
 
 sudo apt-get install build-essential
 Finally, we need to download tcl:
 
 sudo apt-get install tcl8.5
 Installing Redis
 With all of the prerequisites and dependencies downloaded to the server, we can go ahead and begin to install redis from source:
 
 Download the latest stable release tarball from Redis.io.
 
 wget http://download.redis.io/releases/redis-stable.tar.gz
 Untar it and switch into that directory:
 
 tar xzf redis-stable.tar.gz
 cd redis-stable
 Proceed to with the make command:
 
 make
 Run the recommended make test:
 
 make test
 Finish up by running make install, which installs the program system-wide.
 
 sudo make install
 Once the program has been installed, Redis comes with a built in script that sets up Redis to run as a background daemon.
 
 To access the script move into the utils directory:
 
 cd utils
 From there, run the Ubuntu/Debian install script:
 
 sudo ./install_server.sh
 As the script runs, you can choose the default options by pressing enter. Once the script completes, the redis-server will be running in the background.
 
 You can start and stop redis with these commands (the number depends on the port you set during the installation. 6379 is the default port setting):
 
 sudo service redis_6379 start
 sudo service redis_6379 stop
 You can then access the redis database by typing the following command:
 
 redis-cli
 You now have Redis installed and running. The prompt will look like this:
 
 redis 127.0.0.1:6379>
 To set Redis to automatically start at boot, run:
 
 sudo update-rc.d redis_6379 defaults
- 
				แก้ไขถ้ามีเหตุการณ์ redis-server กำลังทำงานอยู่แล้ว กลายเป็นหน้าขาว
 
 อาจจะเกิดขึ้นจาก redis ไปเจอ cache ที่เปิดซ้อนกันครับ
 ทำการลบออกได้โดย
 
 #redis-cli
 >FLUSHDB
 
 หรือ
 
 >FLUSHALL