Skip to content

Commit a675ffe

Browse files
committed
Fix ClickHouse server startup - use background process not daemon
The --daemon flag wasn't working properly, causing connection failures. Replace with background process (&) approach: Changes: - Run server in background with output redirect to log file - Capture PID for debugging - Add error handling to show logs if startup fails after 60s - Remove problematic --daemon and -- syntax Benefits: - More reliable startup - Better debugging with accessible logs - Standard Unix background process approach - Logs available on failure for troubleshooting This should fix the "Connection refused (localhost:9000)" error.
1 parent 4c88764 commit a675ffe

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

.github/workflows/precompile.yml

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,13 @@ jobs:
163163
- name: Start ClickHouse server
164164
run: |
165165
mkdir -p ./clickhouse_data
166-
./clickhouse server --daemon \
167-
-- --path ./clickhouse_data \
166+
./clickhouse server \
167+
--path ./clickhouse_data \
168168
--http_port 8123 \
169-
--tcp_port 9000
169+
--tcp_port 9000 \
170+
> ./clickhouse_server.log 2>&1 &
171+
echo $! > ./clickhouse_server.pid
172+
echo "ClickHouse server started with PID $(cat ./clickhouse_server.pid)"
170173
171174
- name: Wait for ClickHouse
172175
run: |
@@ -177,6 +180,11 @@ jobs:
177180
./clickhouse client --query "SELECT version()"
178181
break
179182
fi
183+
if [ $i -eq 60 ]; then
184+
echo "ClickHouse failed to start. Logs:"
185+
cat ./clickhouse_server.log || echo "No log file found"
186+
exit 1
187+
fi
180188
echo "Still waiting... ($i/60)"
181189
sleep 2
182190
done
@@ -232,10 +240,13 @@ jobs:
232240
- name: Start ClickHouse server
233241
run: |
234242
mkdir -p ./clickhouse_data
235-
./clickhouse server --daemon \
236-
-- --path ./clickhouse_data \
243+
./clickhouse server \
244+
--path ./clickhouse_data \
237245
--http_port 8123 \
238-
--tcp_port 9000
246+
--tcp_port 9000 \
247+
> ./clickhouse_server.log 2>&1 &
248+
echo $! > ./clickhouse_server.pid
249+
echo "ClickHouse server started with PID $(cat ./clickhouse_server.pid)"
239250
240251
- name: Wait for ClickHouse
241252
run: |
@@ -246,6 +257,11 @@ jobs:
246257
./clickhouse client --query "SELECT version()"
247258
break
248259
fi
260+
if [ $i -eq 60 ]; then
261+
echo "ClickHouse failed to start. Logs:"
262+
cat ./clickhouse_server.log || echo "No log file found"
263+
exit 1
264+
fi
249265
echo "Still waiting... ($i/60)"
250266
sleep 2
251267
done

0 commit comments

Comments
 (0)