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

Add new redis database instance for BMP_STATE_DB. #19016

Merged
merged 69 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
a435bbb
Add new redis database instance for BMP_STATE_DB.
FengPan-Frank May 20, 2024
f7a26c8
Add new redis database instance for BMP_STATE_DB.
FengPan-Frank May 20, 2024
40bb7e3
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank May 21, 2024
7935008
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank May 21, 2024
2a0dc1b
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank May 22, 2024
7755bdb
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank May 22, 2024
f678bfe
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank May 22, 2024
1a66414
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank May 22, 2024
d44fb43
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank May 22, 2024
6342a85
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank May 27, 2024
539489e
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank May 27, 2024
f48a410
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank May 28, 2024
24e6642
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank May 29, 2024
986ad60
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank May 28, 2024
ec885e7
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank May 29, 2024
c737507
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank May 30, 2024
3012a60
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank May 29, 2024
cf40663
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank May 31, 2024
1f793a7
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank May 31, 2024
6b7436d
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Jun 3, 2024
53c03e8
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank May 31, 2024
3ebd78c
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Jun 6, 2024
68d5b7f
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Jun 6, 2024
1d22a4a
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Jun 7, 2024
1b56a0a
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Jun 7, 2024
8554c88
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Jun 13, 2024
acb85f1
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Jun 20, 2024
61b2764
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Jul 31, 2024
62f1548
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Aug 8, 2024
69358fc
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Aug 8, 2024
2475d9c
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Aug 14, 2024
15a9c41
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Aug 22, 2024
82dc66c
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Aug 22, 2024
0f7c8df
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Aug 23, 2024
d7964fb
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Aug 23, 2024
be84bd3
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Aug 23, 2024
ac58616
Merge branch 'master' into bmp_db
FengPan-Frank Aug 26, 2024
d506111
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Aug 23, 2024
ccf5149
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Aug 28, 2024
230e16c
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Aug 28, 2024
5720be6
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Aug 29, 2024
cf7bfd8
Merge branch 'master' into bmp_db
FengPan-Frank Aug 29, 2024
a2c4355
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Aug 29, 2024
8b740c2
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Aug 29, 2024
fc2f808
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Aug 29, 2024
affa857
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Sep 4, 2024
63fbc9a
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Sep 9, 2024
fbd913b
Update code
FengPan-Frank Sep 9, 2024
c72953b
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Sep 19, 2024
c990844
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Sep 25, 2024
fdf1908
Fix supervisord.conf issue
FengPan-Frank Sep 27, 2024
345efba
Fix supervisord.conf issue
FengPan-Frank Sep 27, 2024
aaee123
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Sep 30, 2024
16c3368
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Sep 30, 2024
61b905f
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Sep 30, 2024
26b1ae9
Fix supervisord.conf.j2 issue
FengPan-Frank Sep 30, 2024
0f6b846
Fix priority issue
FengPan-Frank Oct 8, 2024
cfdd211
Fix priority issue
FengPan-Frank Oct 8, 2024
a0c762b
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Oct 8, 2024
c63eec3
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Oct 8, 2024
f27c496
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Oct 8, 2024
09dc356
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Oct 8, 2024
9daf859
Merge branch 'bmp_db' of https://github.com/FengPan-Frank/sonic-build…
FengPan-Frank Oct 9, 2024
827bbf7
Fix permission issue
FengPan-Frank Oct 9, 2024
64a31e1
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Oct 9, 2024
fac6493
Address comment
FengPan-Frank Oct 9, 2024
35fc762
Address comments
FengPan-Frank Oct 15, 2024
45ca700
Use separate PR for fixing multiple instance issue
FengPan-Frank Oct 18, 2024
0924195
Merge branch 'sonic-net:master' into bmp_db
FengPan-Frank Oct 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions dockers/docker-database/database_config.json.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@
"unix_socket_path": "",
"persistence_for_warm_boot" : "yes"
}
{% endif %}
{% endif %},
"redis_bmp":{
"hostname" : "{{HOST_IP}}",
"port" : {{BMP_DB_PORT}},
"unix_socket_path" : "/var/run/redis{{DEV}}/redis_bmp.sock",
"persistence_for_warm_boot" : "yes"
}
},
"DATABASES" : {
"APPL_DB" : {
Expand Down Expand Up @@ -129,7 +135,12 @@
"separator": ":",
"instance" : {% if include_remote_db %} "remote_redis" {% else %} "redis" {% endif %}
}
{% endif %}
{% endif %},
"BMP_STATE_DB" : {
"id" : 20,
"separator": "|",
"instance" : "redis_bmp"
}
},
"VERSION" : "1.0"
}
6 changes: 5 additions & 1 deletion dockers/docker-database/docker-database-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ then
fi
fi

export BMP_DB_PORT=6400
FengPan-Frank marked this conversation as resolved.
Show resolved Hide resolved

REDIS_DIR=/var/run/redis$NAMESPACE_ID
mkdir -p $REDIS_DIR/sonic-db
mkdir -p /etc/supervisor/conf.d/

if [ -f /etc/sonic/database_config$NAMESPACE_ID.json ]; then
cp /etc/sonic/database_config$NAMESPACE_ID.json $REDIS_DIR/sonic-db/database_config.json
else
HOST_IP=$host_ip REDIS_PORT=$redis_port DATABASE_TYPE=$DATABASE_TYPE j2 /usr/share/sonic/templates/database_config.json.j2 > $REDIS_DIR/sonic-db/database_config.json
HOST_IP=$host_ip REDIS_PORT=$redis_port DATABASE_TYPE=$DATABASE_TYPE BMP_DB_PORT=$BMP_DB_PORT j2 /usr/share/sonic/templates/database_config.json.j2 > $REDIS_DIR/sonic-db/database_config.json
fi

# on VoQ system, we only publish redis_chassis instance and CHASSIS_APP_DB when
Expand Down Expand Up @@ -130,5 +132,7 @@ rm -rf /etc/localtime
ln -sf /usr/share/zoneinfo/$TZ /etc/localtime

chown -R redis:redis $REDIS_DIR
REDIS_BMP_DIR="/var/lib/redis_bmp"
chown -R redis:redis $REDIS_BMP_DIR

exec /usr/local/bin/supervisord
4 changes: 2 additions & 2 deletions dockers/docker-database/supervisord.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ dependent_startup=true
{%- set ADDITIONAL_OPTS = '' %}
{%- endif -%}
command=/bin/bash -c "{ [[ -s /var/lib/{{ redis_inst }}/dump.rdb ]] || rm -f /var/lib/{{ redis_inst }}/dump.rdb; } && mkdir -p /var/lib/{{ redis_inst }} && exec /usr/bin/redis-server /etc/redis/redis.conf --bind {{ LOOPBACK_IP }} {{ redis_items['hostname'] }} --port {{ redis_items['port'] }} --unixsocket {{ redis_items['unix_socket_path'] }} --pidfile /var/run/redis/{{ redis_inst }}.pid --dir /var/lib/{{ redis_inst }} {{ ADDITIONAL_OPTS }}"
priority=2
FengPan-Frank marked this conversation as resolved.
Show resolved Hide resolved
user=redis
autostart=true
autorestart=false
stdout_logfile=syslog
stderr_logfile=syslog
{%- endif -%}

{% endif %}
{% endfor %}
{% endif %}

Expand Down
4 changes: 4 additions & 0 deletions files/build_templates/docker_image_ctl.j2
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ function preStartAction()
if [[ ("$BOOT_TYPE" == "warm" || "$BOOT_TYPE" == "fastfast" || "$BOOT_TYPE" == "fast") && -f $WARM_DIR/dump.rdb ]]; then
# Load redis content from /host/warmboot/dump.rdb
docker cp $WARM_DIR/dump.rdb database$DEV:/var/lib/redis/dump.rdb
docker cp $WARM_DIR/dump.rdb database$DEV:/var/lib/redis_bmp/dump.rdb
FengPan-Frank marked this conversation as resolved.
Show resolved Hide resolved
else
# Create an emtpy file and overwrite any RDB if already there
echo -n > /tmp/dump.rdb
docker cp /tmp/dump.rdb database$DEV:/var/lib/redis/
docker cp /tmp/dump.rdb database$DEV:/var/lib/redis_bmp/
fi
fi
{%- elif docker_container_name == "pde" %}
Expand Down Expand Up @@ -296,7 +298,9 @@ function postStartAction()
fi
REDIS_SOCK="/var/run/redis-chassis/redis_chassis.sock"
fi
REDIS_BMP_SOCK="/var/run/redis/redis_bmp.sock"
chgrp -f redis $REDIS_SOCK && chmod -f 0760 $REDIS_SOCK
chgrp -f redis $REDIS_BMP_SOCK && chmod -f 0760 $REDIS_BMP_SOCK
{%- elif docker_container_name == "swss" %}
# Wait until swss container state is Running
until [[ ($(docker inspect -f {{"'{{.State.Running}}'"}} swss$DEV) == "true") ]]; do
Expand Down
Loading