Skip to content

Commit 0faba73

Browse files
chore(testing): create cassandra superuser manually
Starting from scylla 2026.2, cassandra superuser is no longer created by default on cluster startup. It is recommended to configure it manually via the maintenance socket. This commit enables maintenance socket for test dev env and uses it to configure cassandra superuser as it was done before, so that the remaining codebase does not need to be changed. Refs scylladb/scylladb#27215 Refs https://scylladb.atlassian.net/wiki/spaces/RND/pages/165773327/Drop+default+cassandra+superuser
1 parent 76e78d5 commit 0faba73

2 files changed

Lines changed: 22 additions & 12 deletions

File tree

testing/Makefile

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
all: help
22

3-
COMPOSE := docker compose
4-
CQLSH := $(COMPOSE) exec scylla-manager-db cqlsh
5-
CQLSH_NODE := $(COMPOSE) exec -T dc1_node_1 cqlsh
6-
NODETOOL := $(COMPOSE) exec -T dc1_node_1 nodetool
7-
SECOND_NODETOOL := $(COMPOSE) exec -T second_cluster_dc1_node_1 nodetool
8-
SM_NODETOOL := $(COMPOSE) exec -T scylla-manager-db nodetool
9-
YQ := ../bin/yq
10-
CURRENT_UID := $(shell id -u)
11-
CURRENT_GID := $(shell id -g)
3+
COMPOSE := docker compose
4+
CQLSH := $(COMPOSE) exec scylla-manager-db cqlsh
5+
CQLSH_NODE := $(COMPOSE) exec -T dc1_node_1 cqlsh
6+
SECOND_CQLSH_NODE := $(COMPOSE) exec -T second_cluster_dc1_node_1 cqlsh
7+
NODETOOL := $(COMPOSE) exec -T dc1_node_1 nodetool
8+
SECOND_NODETOOL := $(COMPOSE) exec -T second_cluster_dc1_node_1 nodetool
9+
SM_NODETOOL := $(COMPOSE) exec -T scylla-manager-db nodetool
10+
YQ := ../bin/yq
11+
CURRENT_UID := $(shell id -u)
12+
CURRENT_GID := $(shell id -g)
1213

1314
SCYLLA_VERSION?=scylla:latest
1415
IP_FAMILY?=IPV4
@@ -122,7 +123,9 @@ endif
122123
$(COMPOSE) exec -T --privileged $$node su root -c '/usr/sbin/sshd'; done
123124

124125
@. ./.env && CURRENT_UID=$(CURRENT_UID) CURRENT_GID=$(CURRENT_GID) $(COMPOSE) -f docker-compose.yaml -f $(COMPOSE_FILE) up -d
125-
@echo "==> Waiting for the rest of containers"
126+
@echo "==> Waiting for second cluster"
127+
@until [ 2 -le $$($(SECOND_NODETOOL) status | grep -c "UN") ]; do echo -n "."; sleep 2; done ; echo ""
128+
@echo "==> Waiting for SM DB"
126129
@until [ 1 -le $$($(SM_NODETOOL) status | grep -c "UN") ]; do echo -n "."; sleep 2; done ; echo ""
127130

128131
@./nodes_exec "rm /root/.cqlshrc || true"
@@ -131,8 +134,15 @@ endif
131134

132135
@echo "==> Adding Minio user"
133136
./minio/add_user.sh || true
134-
@echo "==> Initialising cluster"
137+
@echo "==> Adding cassandra superuser"
138+
# Starting from scylla 2026.2, cassandra superuser is no longer created by default on cluster startup.
139+
# It is recommended to configure it manually via the maintenance socket.
140+
# We need to override the default cqlshrc file for TLS deployments, as maintenance socket does not support TLS connections and does not require any form of authentication.
141+
@$(CQLSH_NODE) /var/lib/scylla/cql.m --cqlshrc=/dev/null -e "CREATE ROLE cassandra WITH PASSWORD = 'cassandra' AND LOGIN = true AND SUPERUSER = true" || true
142+
@$(SECOND_CQLSH_NODE) /var/lib/scylla/cql.m --cqlshrc=/dev/null -e "CREATE ROLE cassandra WITH PASSWORD = 'cassandra' AND LOGIN = true AND SUPERUSER = true" || true
143+
@echo "==> Upgrade auth ks replication"
135144
@$(CQLSH_NODE) $(PUBLIC_NET)11 -u cassandra -p cassandra -e "ALTER KEYSPACE system_auth WITH REPLICATION = {'class': 'NetworkTopologyStrategy', 'dc1': 3, 'dc2': 3}" || true
145+
@echo "==> Upgrade audit ks replication"
136146
@$(CQLSH_NODE) $(PUBLIC_NET)11 -u cassandra -p cassandra -e "ALTER KEYSPACE audit WITH REPLICATION = {'class': 'NetworkTopologyStrategy', 'dc1': 3, 'dc2': 3}" || true
137147

138148
.PHONY: down

testing/scylla/config/scylla.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ strict_is_not_null_in_views: true
605605
# * workdir: the node will open the maintenance socket on the path <scylla's workdir>/cql.m,
606606
# where <scylla's workdir> is a path defined by the workdir configuration option,
607607
# * <socket path>: the node will open the maintenance socket on the path <socket path>.
608-
maintenance_socket: ignore
608+
maintenance_socket: workdir
609609

610610
# If set to true, configuration parameters defined with LiveUpdate option can be updated in runtime with CQL
611611
# by updating system.config virtual table. If we don't want any configuration parameter to be changed in runtime

0 commit comments

Comments
 (0)