redis-sentinel | PHP 5.3 redis-sentinel client | Command Line Interface library
kandi X-RAY | redis-sentinel Summary
kandi X-RAY | redis-sentinel Summary
PHP 5.3+ redis-sentinel client for php based on phpredis extension.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Parse array result
- Connects to sentinel
- get redis instance
- Connect to redis server
- Get master address by master name
- Flush all configs
- Ping redis server
- Get the current sentinel .
redis-sentinel Key Features
redis-sentinel Examples and Code Snippets
$sentinel = new \Jenner\RedisSentinel\Sentinel();
$sentinel->connect('127.0.0.1', 6379);
$address = $sentinel->getMasterAddrByName('mymaster');
$redis = new Redis();
$redis->connect($address['ip'], $address['port']);
$info = $redis->info
Community Discussions
Trending Discussions on redis-sentinel
QUESTION
I'm deploying redis-commander in Kubernetes. I'm creating a configuration connection file for Redis-Commander. I have a command in my bash script to get the required parameters for the connection file as per the link. Managed to connect locally between redis-commander and 1 redis server via sentinel just fine but have many more in non-prod so I need to configure the command below to get desired json output.
This command
...ANSWER
Answered 2021-Apr-16 at 19:19Using map
with .items is probably a better way to go, along the lines of:
QUESTION
I created a learning project using Spring Data Redis, bitnami/redis and bitnami/redis-sentinel images. The Docker Compose file is here. The deployment command is docker-compose -f redis-sentinel.yaml up --scale redis-sentinel=3 --scale redis-replica=2 -d
, so the Redis configuration is as follows:
After bringing everything up, I stop the master container with docker stop redis-master
. After 10 seconds, the sentinels failover to one of the replicas. So far so good. However, nothing is shown in the container console logs for the following very important things:
- master down has been detected.
- Failover has been initiated.
- Failover has successfully completed.
I was expecting the sentinel to log the aspects indicated above.
Also, when I run sentinel masters
command from the Redis CLI of one of the sentinels, I see no difference in the number of replica before and after failover. I was expecting to see the number drop by 1 when the master is shut down.
ANSWER
Answered 2020-Nov-16 at 13:22Please ensure 1. Sentinel Logs are enabled 2. Make sure you are looking at sentinel logs and not master/slave logs. You can find the sentinel.conf file, which has the log file path defined in it .. the default value is logfile "", which logs to standard output.
QUESTION
I want to mark a standalone Redis server (not a Redis-Cluster, not a Redis-Sentinel) as read-only. I have been googling for this for quite sometime but I don't seem to find a definite answer (Almost all answers point to Clustering or Sentinel). I was looking out for some config modification (CONFIG SET something
).
NOTE: config set replica-read-only yes
does not make the current redis-server read-only, but only its replicas.
My use-case basically is I am doing a migration wherein at some point I want to make the redis-server read-only. My application code can handle failures whenever a write call happens so that's not an issue.
Also, if this is not directly possible from redis server, is there something that I can do in the client code that'll have the same effect (I am using redis-py as the client library)? (Although this is less than ideal)
Things that I've tried- Played around with
config set replica-read-only yes
and other configs. They don't seem to be applying the current redis-server. - Tried marking a redis-server as a replica of itself (This was illogical, but just wanted to see if this worked), but turns out it deleted all keys in my local redis, so not something I can do.
ANSWER
Answered 2020-Sep-21 at 00:21There're several solution you can try:
You can use the
rename-command
config to disable write commands. If you only want to disable small number of commands, that's a good solution. However, since there're too many write commands, you might need to have too many configuration, and easy to miss some of them.If you're using Redis 6.0, you can use Redis ACL to disable write commands for specific users.
You can setup a read-only Redis replica for your master, and ask clients to read from the replica.
QUESTION
I have created a docker-compose yml file to run a cron-job in a docker container.
The cron-job which will run inside the docker container has to run a python script and connect to mysql an redis through redis-sentinel.
Cron-job need python and required python-dependencies(mysql and redis sentinel) to be installed in the docker container to run the python script successfully.
here is my docker-compose yml file
...ANSWER
Answered 2020-Sep-02 at 13:07You can use python image directly (if alpine is required, there is versions based on it) https://hub.docker.com/_/python I think that best way to solve your request is build your own docker image:
create docker fileDockerfile
QUESTION
I wanted to have below configuration:
- 1 master and 2 sentinels on host A.
- 1 slave and 1 sentinels on host B.
So for Master, I have created dockerfile like below:
...ANSWER
Answered 2020-Aug-10 at 17:42Dockerfile can only have one CMD instruction, and if you specified multiple, the last one will be execute. So this is the reason you can access sentinel but not redis server.
If you want to execute multiple command, you should use RUN instead and use CMD for the main process.
But I don't recommend to use RUN for sentinel or redis-server as Docker container is very lightweight and each container should focus on its own process(CMD). For sentinels and redis-server, you can create multiple containers on same host(docker-compose should be a potential solution).
QUESTION
I would like to set up a basic 3-node Redis Sentinel setup using the new TLS features of Redis 6. Unfortunately, it doesn't seem like Redis 6 Sentinel is smart enough to speak TLS to clients.
Does anyone know of a way to do this, or if it's not possible, if there are any mentions online about adding support for this in the future? It seems a shame to have these nice TLS features and not be able to use them with Redis' own tools.
I am aware that in the past people have used Stunnel to do this. With TLS support added to Redis, I am only interested in doing this if it can be done without third party addtions.
My setup:
3 Redis servers (6.0-rc, last pulled last week), running TLS with the test certs as specified in the Redis docs - one master and 2 replicas
3 Sentinels (6.0-rc, also last pulled last week), not running TLS on their ports (I would like to, but that's a secondary problem)
What I've Tried:
Pointing Sentinel to the Redis TLS port - this results in lots of TLS errors in Redis' logs about incorrect TLS version received, as Sentinel is not speaking TLS to Redis. Since it fails, Sentinel thinks the master is down.
Adding "https://" in the Sentinel config in front of the master IP - this results in Sentinel refusing to run, saying it can't find the master hostname.
Adding TLS options to Sentinel - this results in Sentinel trying to talk TLS on its ports, but not to clients, which doesn't help. I couldn't find any options specifically about making Sentinel speak TLS to clients.
Pointing Sentinel to the Redis not-TLS port (not ideal, I would rather only have the TLS port open) - this results in Sentinel reporting the wrong (not-TLS) port for the master to the simple Python client I'm testing with (it literally just tries to get master info from Sentinel) - I want the client to talk to Redis over TLS for obvious reasons
Adding the "replica-announce-port" directive to Redis with Sentinel still pointed to the not-TLS port - this fails in 2 ways: the master port is still reported incorrectly as the not-TLS port (seems to be because the master is not a replica and so the directive does not apply), and Sentinel now thinks the replicas are both down (because the TLS port is reported, replicas are auto discovered, and it can't speak to the replicas on the TLS port).
I am aware of this StackOverflow question (Redis Sentinel and TLS) - it is old and asks about Redis 4, so it's not the same.
...ANSWER
Answered 2020-May-25 at 13:01Try to add tls-port option to the sentinel.conf as it seems to enable TLS support in general and the same is stated in documentation. For me the below two statements added to sentinel.conf on a top of the rest of TLS configuration actually made the trick.
tls-port 26379
port 0
QUESTION
I am trying to create a simple redis high availability setup with 1 master, 1 slave and 2 sentinels.
The setup works perfectly when failing over from redis-master
to redis-slave
.
When redis-master
recovers, it correctly register itself as slave to the new redis-slave
master.
However, when redis-slave
as a master goes down, redis-master
cannot return as master. The log of redis-master
go into the loop showing:
ANSWER
Answered 2018-Dec-22 at 15:45It turn out that the problem is related to the used of host name instead of IP:
QUESTION
I have installed latest Redis 4(4.0.14) version.I am trying to setup a 3 node Redis sentinel. I changed my sentinel config file , when I try to run
...ANSWER
Answered 2019-Jun-04 at 15:43Check the file permission on /etc/redis-sentinel.conf
Check for SELINUX sestatus
and if it's running, then try disabling it or add an selinux exceptions.
QUESTION
Redis sentinel setup is done.
what all changes i have to do to point my celery backend to redis-sentinel? i am using redis as a broker for celery executor.
...ANSWER
Answered 2020-Mar-02 at 13:43You have an example in the Configuration section of the Using Redis page in the Celery documentation.
From that page:
QUESTION
What is the port opened by kube-proxy for,Why does it listen on so many ports? From my node, I can see that kube-proxy is listening to a lot of ports. Can someone explain to me why they are listening to so many ports and what is it for? the output like below:
...ANSWER
Answered 2020-Feb-24 at 08:59Based on the official documentation:
kube-proxy reflects services as defined in the Kubernetes API on each node and can do simple TCP, UDP, and SCTP stream forwarding or round robin TCP, UDP, and SCTP forwarding across a set of backends
Basically, it listens for the active Service
s and forwards them across your cluster.
You can get the list of registered services with:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install redis-sentinel
PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page