This is an automated email from the ASF dual-hosted git repository.
starocean999 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 7b94ac70090 [fix](doris compose) fix network sometimes failed (#48898)
7b94ac70090 is described below
commit 7b94ac70090f49bdc4ccccaa8f865d7a7e418b71
Author: yujun <[email protected]>
AuthorDate: Wed Mar 12 09:49:13 2025 +0800
[fix](doris compose) fix network sometimes failed (#48898)
---
docker/runtime/doris-compose/cluster.py | 1 -
docker/runtime/doris-compose/command.py | 21 +++++++++++++--------
docker/runtime/doris-compose/database.py | 8 +++++---
docker/runtime/doris-compose/utils.py | 15 ++++++++++-----
4 files changed, 28 insertions(+), 17 deletions(-)
diff --git a/docker/runtime/doris-compose/cluster.py
b/docker/runtime/doris-compose/cluster.py
index a25abbf9c3c..513916c2867 100644
--- a/docker/runtime/doris-compose/cluster.py
+++ b/docker/runtime/doris-compose/cluster.py
@@ -464,7 +464,6 @@ class Node(object):
if self.cluster.is_host_network():
content["network_mode"] = "host"
- content["ports"] = self.docker_ports()
else:
content["hostname"] = self.get_name()
content["networks"] = {
diff --git a/docker/runtime/doris-compose/command.py
b/docker/runtime/doris-compose/command.py
index 479077f4182..5f69448fca6 100644
--- a/docker/runtime/doris-compose/command.py
+++ b/docker/runtime/doris-compose/command.py
@@ -635,20 +635,25 @@ class UpCommand(Command):
if cluster.remote_master_fe:
if is_new_cluster:
- if not cluster.is_cloud:
- with open(
- CLUSTER.get_master_fe_addr_path(cluster.name),
- "w") as f:
- f.write(cluster.remote_master_fe)
- else:
+ with open(CLUSTER.get_master_fe_addr_path(cluster.name),
+ "w") as f:
+ f.write(cluster.remote_master_fe)
+ if cluster.is_cloud:
cloud_config = "\n".join([
f"meta_service_endpoint =
{cluster.get_meta_server_addr()}",
"deploy_mode = cloud",
f"cluster_id = {CLUSTER.CLUSTER_ID}",
])
+ # write add conf to remote_master_fe_add.conf, remote
fe can send ssh to get this content.
+ with open(
+ os.path.join(
+ CLUSTER.get_status_path(cluster.name),
+ "remote_master_fe_add.conf"), "w") as f:
+ f.write(cloud_config)
ans = input(
- f"\nAdd remote fe {cluster.remote_master_fe}
fe.conf with follow config: \n\n" \
- f"{cloud_config}\n\nConfirm ? y/n: ")
+ utils.render_red(
+ f"\nAdd remote fe {cluster.remote_master_fe}
fe.conf with follow config: "
+ ) + "\n\n" + f"{cloud_config}\n\nConfirm ? y/n: ")
if ans != 'y':
LOG.info(
"Up cluster failed due to not confirm write
the above config."
diff --git a/docker/runtime/doris-compose/database.py
b/docker/runtime/doris-compose/database.py
index 50c052dc740..1a5b2d57642 100644
--- a/docker/runtime/doris-compose/database.py
+++ b/docker/runtime/doris-compose/database.py
@@ -186,6 +186,8 @@ class DBManager(object):
"provider" = "{cloud_store_config['DORIS_CLOUD_PROVIDER']}"
);
"""
+ # create hk storage vault from beijing cost 14s
+ self._reset_conn(read_timeout=20)
self._exec_query(create_vault_sql)
LOG.info("Created storage vault 'default_vault'")
@@ -294,11 +296,11 @@ class DBManager(object):
return
self._reset_conn()
- def _reset_conn(self):
+ def _reset_conn(self, read_timeout=10, connect_timeout=3):
self.conn = pymysql.connect(user="root",
host=self.fe_ip,
- read_timeout=10,
- connect_timeout=3,
+ read_timeout=read_timeout,
+ connect_timeout=connect_timeout,
port=self.fe_port)
diff --git a/docker/runtime/doris-compose/utils.py
b/docker/runtime/doris-compose/utils.py
index 47c3fe45f4b..4ff87ef2229 100644
--- a/docker/runtime/doris-compose/utils.py
+++ b/docker/runtime/doris-compose/utils.py
@@ -303,11 +303,16 @@ def get_local_ip():
with contextlib.closing(socket.socket(socket.AF_INET,
socket.SOCK_DGRAM)) as sock:
sock.settimeout(0)
- try:
- sock.connect(('10.255.255.255', 1))
- return sock.getsockname()[0]
- except Exception:
- return '127.0.0.1'
+ # the ip no need reachable.
+ # sometime connect to the external network '10.255.255.255' throw
exception 'Permissions denied',
+ # then change to connect to the local network '192.168.0.255'
+ for ip in (('10.255.255.255'), ('192.168.0.255')):
+ try:
+ sock.connect((ip, 1))
+ return sock.getsockname()[0]
+ except Exception as e:
+ LOG.info(f"get local ip connect {ip} failed: {e}")
+ return '127.0.0.1'
def enable_dir_with_rw_perm(dir):
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]