-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[database]: Update the DPU database service configuration #17562
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
Changes from 1 commit
1f5c985
bc8329b
e7ea7a9
9ab085f
ac8f06f
9b7d70c
dc04804
10fd6e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
{% set include_remote_db = (REMOTE_DB_IP is defined and REMOTE_DB_PORT is defined) %} | ||
{ | ||
"INSTANCES": { | ||
"redis":{ | ||
|
@@ -15,6 +16,14 @@ | |
"unix_socket_path": "/var/run/redis-chassis/redis_chassis.sock", | ||
"persistence_for_warm_boot" : "yes" | ||
} | ||
{% if include_remote_db %} | ||
,"remote_redis":{ | ||
"hostname" : "{{REMOTE_DB_IP}}", | ||
"port" : {{REMOTE_DB_PORT}}, | ||
"unix_socket_path": "" | ||
"persistence_for_warm_boot" : "yes" | ||
} | ||
{% endif %} | ||
}, | ||
"DATABASES" : { | ||
"APPL_DB" : { | ||
|
@@ -102,23 +111,23 @@ | |
"DPU_APPL_DB" : { | ||
"id" : 15, | ||
"separator": ":", | ||
"instance" : "redis", | ||
"instance" : {% if include_remote_db%} "remote_redis" {% else %} "redis" {% endif %}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
"format": "proto" | ||
}, | ||
"DPU_APPL_STATE_DB" : { | ||
"id" : 16, | ||
"separator": "|", | ||
"instance" : "redis" | ||
"instance" : {% if include_remote_db%} "remote_redis" {% else %} "redis" {% endif %} | ||
}, | ||
"DPU_STATE_DB" : { | ||
"id" : 17, | ||
"separator": "|", | ||
"instance" : "redis" | ||
"instance" : {% if include_remote_db%} "remote_redis" {% else %} "redis" {% endif %} | ||
}, | ||
"DPU_COUNTERS_DB" : { | ||
"id" : 18, | ||
"separator": ":", | ||
"instance" : "redis" | ||
"instance" : {% if include_remote_db%} "remote_redis" {% else %} "redis" {% endif %} | ||
} | ||
{% endif %} | ||
}, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,19 @@ if [[ $DATABASE_TYPE == "dpudb" ]]; then | |
redis_port=`expr 6381 + $DPU_ID` | ||
fi | ||
|
||
# TODO: Check the current platform is DPU | ||
midplane_ip=$(ip -4 -o addr | grep -v "169.254.200.254" | grep "169.254.200" | awk '{print $4}' | cut -d'/' -f1 | head -1 ) | ||
if [[ $midplane_ip != "" ]] | ||
then | ||
export DATABASE_TYPE="dpudb" | ||
export REMOTE_DB_IP="169.254.200.254" | ||
IFS=. read -r a b c d <<< "169.254.200.1" | ||
midplane_base_ip_num=$((a * 256 ** 3 + b * 256 ** 2 + c * 256 + d)) | ||
# Determine the DB PORT from midplane IP | ||
IFS=. read -r a b c d <<< $midplane_ip | ||
midplane_ip_num=$((a * 256 ** 3 + b * 256 ** 2 + c * 256 + d)) | ||
export REMOTE_DB_PORT=$((6381 + $midplane_ip_num - $midplane_base_ip_num)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Pterosaur you can get the ip from the "eth0-midplane" interface. Use the last digit (1 for DPU1, 2 for DPU 2, and so on)
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good suggestion, done. |
||
fi | ||
|
||
REDIS_DIR=/var/run/redis$NAMESPACE_ID | ||
mkdir -p $REDIS_DIR/sonic-db | ||
|
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.
@Pterosaur which design doc are you following? I am not sure, if the DPU_
will be hosted on the NPU side or DPU side?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.
Add the design doc to the description and that has been reviewed by community.