Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Support for Redis Sentinel #311

Closed
dbeckers99 opened this issue Jan 7, 2023 · 12 comments
Closed

[Feature Request]: Support for Redis Sentinel #311

dbeckers99 opened this issue Jan 7, 2023 · 12 comments
Assignees
Labels
enhancement It's not a bug, but it's worth an enhancement.

Comments

@dbeckers99
Copy link

Description

I'm running my iobroker Multihost installation with objects and states in a Redis Sentinel DB. Sentinel supports and handles automatic fail over in case of the Redis Master goes down.

iobroker supports this feature in "iobroker setup custom": you specify a comma separated list of redis Sentinel host is, next step the Sentinel port(s) - default 26379 - to this hosts. These two parameters can already be set in iobroker docker image ENV with the flags IOB_STATESDB_*.

But: during "iobroker setup custom" the next step is giving the redis master DB name, normally "mymaster". This is because iobroker asks the given list of redis Sentinel host(s) for the active redis master host by using this name and gets the IP in return.

To use a ioBroker docker image with full support of redis Sentinel this parameter (e.g. IOB_STATESDB_MASTERNAME) should be settable to ENV and used if building the container with redis Sentinel (a comma separated list of IPs).

@dbeckers99 dbeckers99 added the enhancement It's not a bug, but it's worth an enhancement. label Jan 7, 2023
@dbeckers99
Copy link
Author

Is possible via command line: iobroker setup custom

@buanet
Copy link
Owner

buanet commented Feb 12, 2023

Together with #306 it sounds like there is a rework of states- and objects-db integration needed. I already have this on my to do list.

@buanet buanet self-assigned this Feb 12, 2023
@buanet
Copy link
Owner

buanet commented Feb 20, 2023

Feature is now available in v8.0.0-beta.1.
Because I have no sentinel setup running, I was not able to test this feature.
It's now possible to insert multiple hosts and ports and a db name. If no name is specified, the system will go with "mymaster" as default. If only one Port is specified, it will be used for all hosts.
As this is still beta, documentation is missing so far.

example:

    environment:
      - IOB_OBJECTSDB_TYPE=redis
      - IOB_OBJECTSDB_HOST=redis,redis1
      - IOB_OBJECTSDB_PORT=26379,26380 # if single value, it is used for all hosts
      - IOB_OBJECTSDB_NAME=mymaster
      - IOB_STATESDB_TYPE=redis
      - IOB_STATESDB_HOST=redis,redis1
      - IOB_STATESDB_PORT=26379,26380
      - IOB_STATESDB_NAME=mymaster

Would be nice if someone cloud test this and give some feedback. If I get no feedback, I will add this feature as "experimental" to upcoming v8.0.0 stable.

Regards,
André

@Apollon77
Copy link
Contributor

BZW: It is more best practice to use IPs instead of hostnames because in such an "HA" environment you do not want to have a DNS as "single point of failure" :-)

@buanet
Copy link
Owner

buanet commented Feb 21, 2023

@Apollon77 Put in what ever you want as long as it is comma separated... :)

@Apollon77
Copy link
Contributor

lol (I mean maybe state in exmple or such)

@buanet
Copy link
Owner

buanet commented Mar 7, 2023

@dbeckers99 Any feedback until I move this to a stable state?

Regards,
André

@dbeckers99
Copy link
Author

At least it is working for me with the ENV vars in docker container (provided by an env-file). But after start and configure iobroker inside the container, I have to preform "iobroker stop" and "iobroker setup custom" to get iobroker using the Sentinel settings and entering the iobroker cluster.

@buanet
Copy link
Owner

buanet commented Mar 20, 2023

Version 8 is now stable. https://github.com/buanet/ioBroker.docker/releases/tag/v8.0.0

@dbeckers99 Do you use redis as objects db too? If yes, you have to do the iobroker setup custom when you change an existing iobroker for migration.
If you start with a new iobroker instance the startup script should do the db init itself...
Maybe you can give some more details?
https://docs.buanet.de/iobroker-docker-image/docs/#migrating-to-redis

Regards,
André

@dbeckers99
Copy link
Author

dbeckers99 commented Mar 26, 2023

Yes, I'm running redis for states AND objects.

EDIT: some wrong things removed. Sorry

@buanet
Copy link
Owner

buanet commented Mar 26, 2023

Sorry, ich kann dir nicht folgen. Vielleicht ist es einfacher in deutsch?

MfG,
André

@dbeckers99
Copy link
Author

Sorry, war mein Fehler. Habe den Container bei gebaut mit falschem Hostname...
Es funktioniert bei mir und ja, ich verwende Redis für States und Objects.

@buanet buanet closed this as completed Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement It's not a bug, but it's worth an enhancement.
Projects
None yet
Development

No branches or pull requests

3 participants