Skip to content

Commit

Permalink
use right ip to register broker when in hostnetwork
Browse files Browse the repository at this point in the history
  • Loading branch information
usernameisnull committed Jan 6, 2024
1 parent 674666f commit 9ff2e8a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion images/broker/alpine/brokerGenConfig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ function create_config() {
echo "brokerClusterName=$BROKER_CLUSTER_NAME" >> $BROKER_CONFIG_FILE
echo "brokerName=$BROKER_NAME" >> $BROKER_CONFIG_FILE
echo "brokerId=$BROKER_ID" >> $BROKER_CONFIG_FILE
echo "brokerIP1=`hostname -i`" >> $BROKER_CONFIG_FILE

BROKER_NETWORK_DEV=`/sbin/route |awk '/^default/{print $NF}'`
BROKER_IP=`ip a s ${BROKER_NETWORK_DEV} |awk -F' +|/' '/ inet /{print $3}'`
echo "brokerIP1=${BROKER_IP}" >> $BROKER_CONFIG_FILE
if [ $BROKER_ID != 0 ]; then
sed -i 's/brokerRole=.*/brokerRole=SLAVE/g' $BROKER_CONFIG_FILE
fi
Expand Down

0 comments on commit 9ff2e8a

Please sign in to comment.