Installation
Before we start using Redis in PHP, we need to make sure that we have the Redis service and PHP Redis driver installed, and that PHP is working properly on your machine. Next let's install the PHP redis driver: Download the address:
We all know that Redis is implemented in C, now I use PHP to implement a simple only support set and get command of the Redis server, mainly to better understand the Redis server and PHP network programming.
The code is as follows:
/***
Spent two days, read the countless Chinese code, and finally on their own notebook loaded with Redis, below the tutorial.
First of all, do not understand redis Why use the Please first Baidu ...
Download the Redis windows32 bit
Master ip:192.168.240.78Backup ip:192.168.240.79Virtual ip:192.168.240.89Slave ip:192.168.240.80Slave2 ip:192.168.240.81Features to implement:1. When master and slave are operating normally, Master is responsible for writing, backup is responsible
Read and write on the Redis terminal, found only unreadable, get operation is normal, set operation prompt error: (error) misconf Redis is configured to save RDB Snapshots,but is currently Not able to persist on disk. Commands that may modify the
Simple to use:Set insert String, get view
[Root@yum-down ~]# redis-cli-h 10.10.0.250-p 637910.10.0.250:6379> Set KeyName HelloOk10.10.0.250:6379> Get KeyName"Hello"10.10.0.250:6379>Filter:Show All
10.10.0.250:6379> keys *1) "Keya"2) "Keyna"3)
I. Redis self-with transaction mechanism
Redis transactions are operated through the multi, EXEC, discard, watch, and Unwatch commands, as follows:Open the transaction through the multi, then add any command to the queue, execute the queue command
redis Database definition: typedef struct REDISDB {Dict *dict; /* The keyspace for this DB */Dict *expires; /* Timeout of keys with a Timeout set */Dict *blocking_keys; /* Keys with clients waiting for data (blpop) * *Dict *ready_keys; /* Blocked
The demand analysis of the red envelope robbery
The scene of the robbery is a bit like a second kill, but more simple than the second kill.
Because the second kill is usually related to inventory. And Rob Red envelopes can allow some red envelopes
Objective
You may encounter this need in your work, that is, Redis read and write separation, the purpose is to disperse pressure. Below I will introduce the use of AWS Elb to achieve read-write separation, to write the main read from the example.
About RedisRedis is an open source, a distributed NoSQL database system that uses the C language for "key/value" type data, characterized by high performance, persistent storage, and adapting to high concurrency scenarios. Redis is purely for the
Redis clusters: Run multiple Redis instances and then connect them in a relationship with a specific tool to form a Redis network.Detailed content can be read: Redis cluster tutorialIt will introduce the design idea and internal structure of Redis
Redis Implements distributed locksIn the cluster and other multi-server often to use to synchronize the business, then the ordinary transaction is to meet the needs of the business, the need for distributed locks. Distributed locks are implemented
Redis ordered set (sorted set)A Redis ordered collection is a collection of elements of type string, as well as a collection, and does not allow duplicate members.The difference is that each element is associated with a double-type fraction. Redis
1.The best way to network is to bridge. I used "Network address translation (NAT)", resulting in the virtual machine with the command ifconfig to get the IP is 10.0.2.15, a strange feeling, and then on the real machine has not been connected. Some
1. Redis is not running as a daemon by default and can be modified by this configuration item, enabling the daemon with Yesdaemonize No2. When Redis is running as a daemon, Redis writes the PID to the/var/run/redis.pid file by default and can be
Tag: Redis user hot Forget RMI cat net possibility exitPre-Knowledge: The simplest basic command for Redis:1. System Terminal./redis-server Start Redis Service./REDIS-CLI starting the Redis client./redis-cli shutdown turn off Redis service2. After
The principle of Redis master-slave replication:The 1.slave server connects to the master database #端口, password, the Ip2.slave server sends the SYCN command #异步请求备份 the 3.master server is backed up to an. rdb file (Local database) #就是类似于做个镜像, but
If the MySQL database is large, we can easily find out which tables occupy the space. However, if the Redis memory is large, it is not easy to find out which tables occupy the space) the space occupied by the key.Some tools can provide necessary
1. Download the redis file in windows, decompress it, and put it in a directory to enable the redis package download.Redis-server.exe redis. conf // enter redis directory to enable redis Service Command2. Restart a cmd command window to start
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.