Redis Master and Subordinate, Sentinel, Jedis
As mentioned in the previous article Redis Installation and Operation . Today let's look at Redis's master-slave replication, Sentinel;
I. Master-slave duplication
1. configuration
Modify redis.conf on Master
// Do not want to use password, so set protection mode to no
protected-mode no
// In fact, there is no need to configure anyth ...
Posted by Arsenal Rule on Wed, 27 Mar 2019 22:00:29 -0700
redis realizes the function of second killing and ticket grabbing
I. Preface
Practice is the sole criterion for testing truth. It's shallow on paper. If you want to know a person, just rely on personal data, even if you meet and talk about one or two sentences, it will also produce a lot of contingent results. As the saying goes, adversity can see the truth. Of course, here is not to let you ...
Posted by nankoweap on Wed, 27 Mar 2019 05:36:29 -0700
Redis operation command for key (with PHP code)
Redis Operational Command for key
del key1 key2 Keyn
To delete one or more keys
rename key newkey
The function assigns a new key name to the key
renamenx key newkey
Function to rename key to newkey
move key db
keys pattern queries for corresponding key s
Random key returns random key
exists key
Determine whether key exist ...
Posted by hardius on Mon, 25 Mar 2019 10:15:30 -0700
Introduction to Jedis API Operating Redis Database
public void testClient() {
jedisCli = new Jedis("127.0.0.1", 6379); //New Jedis object
jedisCli.select(2); //Select Redis database number
jedisCli.set("firstJedis", "hello,Jedis"); //It is basically the same as the redis command line client operation.
System.out.println(jedisCli.get("firstJedis"));
System.out.println(jedisCli.exists(" ...
Posted by fullyloaded on Sun, 24 Mar 2019 15:03:28 -0700
Integrating Redis with Spring + Jedis
I. Integrated Environment
Tomcat7
JDK1.7
Jedis-2.7.2
Spring-4.1.6
II. Resource Dependence
(ellipsis, a lot on the internet)
III. Integration process
1. Resource pool allocation
This is managed using Jedis's Harded JedisPool. We define the configuration file as spring-redis.xml, which reads as follows:
<?xml version="1.0" encoding=" ...
Posted by Drezek on Sat, 23 Mar 2019 13:54:53 -0700
Python 3.7.0 + Django 2.0.4 pits encountered using django-celery
First of all, you know that Django is a synchronization framework.
In order to speed up user response time and improve user experience. So I decided to use asynchronous tasks to perform some tasks in the background.
In addition to asynchronous tasks, celery can also start timing tasks to facilitate scheduling.
Packages to be ins ...
Posted by forgun on Wed, 20 Mar 2019 15:39:25 -0700
lua module demo (redis, http, mysql, cjson, local cache)
1. lua module demo (redis, http, mysql, cjson, local cache)
1.1. configuration
Set lua_shared_dict my_cache 128m in nginx.conf; open nginx local cache and put it in http {} layer
location configuration
location /redis-get{
resolver 8.8.8.8;
default_type text/html;
content_by_lua_file /usr/local/openresty/lua/redis-get.lua;
}
Her ...
Posted by webosb on Fri, 08 Mar 2019 00:48:25 -0800
Bloom filter based on redis(key segment to avoid too large a key) and db (to solve hash collision problem)
1. Calculate the hash value of the key.
2. The offset offset is calculated according to hash value and fixed segment size.
3. The bitKey of the segment is calculated according to the fixed pre-hash value/the size of the fixed segment.
4. Judge whether it exists according to bitKey and offset.
5. If it exists, then call containsFromDb to determi ...
Posted by PerfecTiion on Wed, 13 Feb 2019 09:15:18 -0800
Use Docker to build development environment, including (nginx, redis, mysql, gitlab, nexus 3, activemq, jenkins)
Using Docker to Build Development Environment
Since playing Docker, I have been deeply fascinated by Docker and have been working on software for so many years. I never expected that software would develop to this stage. Using container isolation technology to isolate various service processes, I am glad to have access to this ...
Posted by Sonu Kapoor on Wed, 06 Feb 2019 22:33:16 -0800
supervisor boot script + redis+MySQL+tomcat+nginx process automatic restart configuration
supervisor boot-up automatic restart script
#! /bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PROGNAME=supervisord
DAEMON=/usr/bin/$PROGNAME
CONFIG=/etc/$PROGNAME.conf
PIDFILE=/tmp/$PROGNAME.pid
DESC="supervisord daemon"
SCRIPTNAME=/etc/init.d/$PROGNAME
# Gracefully exit if the package has been removed.
test -x $DAEMON || exit 0
start()
{
...
Posted by clairian on Wed, 06 Feb 2019 20:27:17 -0800