-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
multi-DB Part 1: create multiple Redis DB instances based on CONFIG at /etc/sonic/database_config.json #2182
Conversation
Once the solution is agreed upon, "Configuration DB schema" section of https://github.com/Azure/sonic-swss/blob/master/doc/swss-schema.md should be updated with redis db instance schema. |
May I ask a well formatted design doc before reviewing the implementation? We don't want to waste your time on implementation when we still have concerns on the design. #Closed |
sure. I'll prepare some slides to introduce the ideas. We can share it on the weekly meeting.
#Resolved |
The Design DOC is here
#Resolved |
6c1c048
to
66f8945
Compare
@@ -35,6 +35,15 @@ RUN sed -ri 's/^(save .*$)/# \1/g; \ | |||
s/^client-output-buffer-limit pubsub [0-9]+mb [0-9]+mb [0-9]+/client-output-buffer-limit pubsub 0 0 0/ \ | |||
' /etc/redis/redis.conf | |||
|
|||
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] | |||
|
|||
ENTRYPOINT ["/usr/bin/supervisord"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
supervisord [](start = 22, length = 11)
supervisord [](start = 22, length = 11)
We prefer keep supervisord as entrypoint. You may refer other docker containers for example with a start.sh. #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the database_config file is static as you said, then we can use supervisord as Entrypoint, and we can generate supervisord.conf during compiling/building
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping supervisord as entrypoint is a good practice. Even with database_config.json, it shall be possilble to generate redis-server.sh from redis-server.sh.j2 within db-docker-init.sh(dockers/docker-database/docker_init.sh), and let redis-server.sh handle the dynamic db instances case?
[program:db-docker-init.sh]
command=/usr/bin/db-docker-init.sh
priority=2
autostart=true
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:redis-server.sh]
command=/usr/bin/redis-server.sh
priority=3
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As comments
@qiluo-msft Thanks, will take a look #Resolved |
I haven't followed the entire thread but I will read through it. In the meantime a comment on the config part that caught my eye - I feel that the database config should be under /etc/sonic/database or under /etc/sonic/db. Also I would suggest against a rigid/static config db file. #Resolved |
From switch operator's point of view, this is not a config and it is an implementation detail and can be static in an image. Since it is a "config" for redis partitioning, it will be weird that we store it in a redis db. In reply to: 447149304 [](ancestors = 447149304) |
460ea33
to
e7ad9d8
Compare
@qiluo-msft re-commit the codes, please have a look when you are available. |
@dzhangalibaba Could you keep old commits and add new iteration as incremental commits. The review context are all lost and it is difficult to check your improvement. #Closed |
Sorry Qi, I used git push -force on my local branch and the old commit is overwritten. I thought the comment on this PR is enough and didn't keep the old commit. I'll keep them in future commit. Basically, the main changes is : The new changes in the commit is more clear to follow. Could you take a look and comment. Thanks. Best,
|
@@ -35,6 +35,15 @@ RUN sed -ri 's/^(save .*$)/# \1/g; \ | |||
s/^client-output-buffer-limit pubsub [0-9]+mb [0-9]+mb [0-9]+/client-output-buffer-limit pubsub 0 0 0/ \ | |||
' /etc/redis/redis.conf | |||
|
|||
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] | |||
|
|||
ENTRYPOINT ["/usr/bin/supervisord"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping supervisord as entrypoint is a good practice. Even with database_config.json, it shall be possilble to generate redis-server.sh from redis-server.sh.j2 within db-docker-init.sh(dockers/docker-database/docker_init.sh), and let redis-server.sh handle the dynamic db instances case?
[program:db-docker-init.sh]
command=/usr/bin/db-docker-init.sh
priority=2
autostart=true
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
[program:redis-server.sh]
command=/usr/bin/redis-server.sh
priority=3
autostart=false
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
707df1f
to
a7e5a0e
Compare
redesign and recode this PR after the discussion with SONiC team |
f64aca6
to
a8e69b0
Compare
thanks for the work. only one comment is left. |
modified as required |
retest this please |
retest this please |
…base_config.json (sonic-net#2182) this is the first step to moving different databases tables into different database instances in this PR, only handle multiple database instances creation based on user configuration at /etc/sonic/database_config.json we keep current method to create single database instance if no extra/new DATABASE configuration exist in database_config.json file. if user try to configure more db instances at database_config.json , we create those new db instances along with the original db instance existing today. The configuration is as below, later we can add more db related information if needed: { ... "DATABASE": { "redis-db-01" : { "port" : "6380", "database": ["APPL_DB", "STATE_DB"] }, "redis-db-02" : { "port" : "6381", "database":["ASIC_DB"] }, } ... } The detail description is at design doc at sonic-net/SONiC#271 The main idea is : when database.sh started, we check the configuration and generate corresponding scripts. rc.local service handle old_config copy when loading new images, there is no dependency between rc.local and database service today, for safety and make sure the copy operation are done before database try to read it, we make database service run after rc.local Then database docker started, we check the configuration and generate corresponding scripts/.conf in database docker as well. based on those conf, we create databases instances as required. at last, we ping_pong check database are up and continue Signed-off-by: Dong Zhang d.zhang@alibaba-inc.com
this is the first step to moving different databases tables into different database instances
in this PR, only handle multiple database instances creation based on user configuration at /etc/sonic/database_config.json
we keep current method to create single database instance if no extra/new DATABASE configuration exist in database_config.json file.
if user try to configure more db instances at database_config.json , we create those new db instances along with the original db instance existing today.
The configuration is as below, later we can add more db related information if needed:
{
...
"DATABASE": {
"redis-db-01" : {
"port" : "6380",
"database": ["APPL_DB", "STATE_DB"]
},
"redis-db-02" : {
"port" : "6381",
"database":["ASIC_DB"]
},
}
...
}
The detail description is at design doc at Design of creating user defined multiple database instances SONiC#271
The main idea is : when database.sh started, we check the configuration and generate corresponding scripts.
rc.local service handle old_config copy when loading new images, there is no dependency between rc.local and database service today, for safety and make sure the copy operation are done before database try to read it, we make database service run after rc.local
Then database docker started, we check the configuration and generate corresponding scripts/.conf in database docker as well.
based on those conf, we create databases instances as required.
at last, we ping_pong check database are up and continue
Signed-off-by: Dong Zhang d.zhang@alibaba-inc.com