|
11 | 11 |
|
12 | 12 |
|
13 | 13 | SERVER_LOOP_IP = "0.0.0.0"
|
14 |
| -SERVER_API_PORT = lambda p, r: 40100 + (p * 10 + r) |
15 |
| -SERVER_P2P_PORT = lambda p, r: 40200 + (p * 10 + r) |
16 |
| -SERVER_BIND_BASE_PORT = lambda p, r: 41000 + (p * 10 + r) * 10 |
| 14 | +SERVER_API_PORT = lambda p, r: 40000 + (p * 20 + r) |
| 15 | +SERVER_P2P_PORT = lambda p, r: 40010 + (p * 20 + r) |
17 | 16 |
|
18 | 17 | MANAGER_LOOP_IP = "0.0.0.0"
|
19 |
| -MANAGER_SRV_PORT = lambda p: 40000 + p * 10 |
20 |
| -MANAGER_CLI_PORT = lambda p: 40001 + p * 10 |
| 18 | +MANAGER_CLI_PORT = lambda p: 40009 + p * 20 # NOTE: assuming at most 9 servers |
| 19 | +MANAGER_SRV_PORT = lambda p: 40019 + p * 20 |
21 | 20 |
|
22 | 21 |
|
23 | 22 | PROTOCOL_BACKER_PATH = (
|
@@ -127,29 +126,26 @@ def config_dict_to_str(d):
|
127 | 126 | return config_dict_to_str(config_dict)
|
128 | 127 |
|
129 | 128 |
|
130 |
| -def compose_manager_cmd(protocol, bind_ip, srv_port, cli_port, num_replicas, release): |
| 129 | +def compose_manager_cmd(protocol, srv_port, cli_port, num_replicas, release): |
131 | 130 | cmd = [f"./target/{'release' if release else 'debug'}/summerset_manager"]
|
132 | 131 | cmd += [
|
133 | 132 | "-p",
|
134 | 133 | protocol,
|
135 | 134 | "-b",
|
136 |
| - bind_ip, |
137 |
| - "-s", |
138 |
| - str(srv_port), |
| 135 | + MANAGER_LOOP_IP, |
139 | 136 | "-c",
|
140 | 137 | str(cli_port),
|
| 138 | + "-s", |
| 139 | + str(srv_port), |
141 | 140 | "-n",
|
142 | 141 | str(num_replicas),
|
143 | 142 | ]
|
144 | 143 | return cmd
|
145 | 144 |
|
146 | 145 |
|
147 | 146 | def launch_manager(protocol, partition, num_replicas, release):
|
148 |
| - bind_ip = MANAGER_LOOP_IP |
149 |
| - |
150 | 147 | cmd = compose_manager_cmd(
|
151 | 148 | protocol,
|
152 |
| - bind_ip, |
153 | 149 | MANAGER_SRV_PORT(partition),
|
154 | 150 | MANAGER_CLI_PORT(partition),
|
155 | 151 | num_replicas,
|
@@ -177,15 +173,13 @@ def wait_manager_setup(proc):
|
177 | 173 | break
|
178 | 174 |
|
179 | 175 |
|
180 |
| -def compose_server_cmd( |
181 |
| - protocol, bind_base, api_port, p2p_port, manager, config, release |
182 |
| -): |
| 176 | +def compose_server_cmd(protocol, api_port, p2p_port, manager, config, release): |
183 | 177 | cmd = [f"./target/{'release' if release else 'debug'}/summerset_server"]
|
184 | 178 | cmd += [
|
185 | 179 | "-p",
|
186 | 180 | protocol,
|
187 | 181 | "-b",
|
188 |
| - bind_base, |
| 182 | + SERVER_LOOP_IP, |
189 | 183 | "-a",
|
190 | 184 | str(api_port),
|
191 | 185 | "-i",
|
@@ -224,13 +218,10 @@ def launch_servers(
|
224 | 218 | server_procs = []
|
225 | 219 | for replica in range(num_replicas):
|
226 | 220 | host = hosts[replica]
|
227 |
| - |
228 |
| - bind_base = f"{SERVER_LOOP_IP}:{SERVER_BIND_BASE_PORT(partition, replica)}" |
229 | 221 | manager_addr = f"{manager_pub_ip}:{MANAGER_SRV_PORT(partition)}"
|
230 | 222 |
|
231 | 223 | cmd = compose_server_cmd(
|
232 | 224 | protocol,
|
233 |
| - bind_base, |
234 | 225 | SERVER_API_PORT(partition, replica),
|
235 | 226 | SERVER_P2P_PORT(partition, replica),
|
236 | 227 | manager_addr,
|
|
0 commit comments