Skip to content

Commit

Permalink
Add port to config file instead of cli
Browse files Browse the repository at this point in the history
  • Loading branch information
JelteF committed Feb 23, 2024
1 parent 12875fb commit dfeebd0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions citus_dev/citus_dev
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def run(command, *args, **kwargs):
return result


def createNodeCommands(clustername, role, arguments, index=None):
def createNodeCommands(clustername, role, port, arguments, index=None):
nodename = role
if index != None:
nodename += "%d" % index
Expand All @@ -63,6 +63,7 @@ def createNodeCommands(clustername, role, arguments, index=None):

shared_preload_libraries = ','.join(shared_preload_libraries)

run(f"echo \"port = {port}\" >> {clustername}/{nodename}/postgresql.conf")
run(f"echo \"shared_preload_libraries = '{shared_preload_libraries}'\" >> {clustername}/{nodename}/postgresql.conf")
run(f'echo "wal_level = logical" >> {clustername}/{nodename}/postgresql.conf')
if not arguments['--fsync']:
Expand Down Expand Up @@ -118,40 +119,39 @@ def main(arguments):
run(f'rm -rf {clustername}')


port = int(arguments["--port"])
cport = port
createNodeCommands(
clustername,
"coordinator",
port,
arguments,
)

port = int(arguments["--port"])
size = int(arguments["--size"])
pgbouncer = bool(arguments["--with-pgbouncer"])

if pgbouncer:
createPgBouncerUsers(clustername)

for i in range(size):
port += 1
createNodeCommands(
arguments["<name>"],
"worker",
port,
arguments,
i,
)
if pgbouncer:
createPgBouncerConfig(clustername, port, i)

cport = port
role = "coordinator"
run(f'pg_ctl {pgctl_flags} -D {clustername}/{role} -o "-p {cport}" -l {role}_logfile start')
port += 1
run(f'pg_ctl {pgctl_flags} -D {clustername}/{role} -l {role}_logfile start')

worker_ports = []
for i in range(size):
role = "worker%d" % i
worker_ports.append(port)
run(f'pg_ctl {pgctl_flags} start -D {clustername}/{role} -o "-p {port}" -l {role}_logfile')
port += 1
run(f'pg_ctl {pgctl_flags} start -D {clustername}/{role} -l {role}_logfile')
port = cport

if getpass.getuser() != 'postgres' and not os.getenv('PGDATABASE'):
Expand Down

0 comments on commit dfeebd0

Please sign in to comment.