Database file is deleted when create a cluster

111 views
Skip to first unread message

vincenzo199970

unread,
Dec 4, 2020, 2:54:06 PM12/4/20
to H2 Database
I'm experimenting with the CreateCluster tool.
I have two computers on my lan:
Computer A (Windows 10) on address 192.168.1.105
Computer B (Ubuntu) on address 192.1681.1.103

I take the following steps:
1. Create the database on Computer A using the console. The address is "jdbc:h2:~/cluster/test" (the db file is created).

2. Create the database on Computer B using the console. The address is "jdbc:h2:~/cluster/test" (the db file is created).

3. Start the tcp server on Computer A using cmd: "java -cp h2-*.jar org.h2.tools.Server -tcp -tcpPort 9101 -tcpAllowOthers"

4. Start the tcp server on Computer B using terminal: "java -cp h2-*.jar org.h2.tools.Server -tcpPort 9101 -tcpAllowOthers"

5. Create the cluster from Computer A using cmd: "java -cp h2-*.jar org.h2.tools.CreateCluster -urlSource jdbc:h2:tcp://192.168.1.105:9101/~/cluster/test -urlTarget jdbc:h2:tcp://192.168.1.103:9101/~/cluster/test -user root -password "..." -serverList  192.168.1.105:9101,192.168.1.103:9101

When I complete the step 5, the database file on Computer B is deleted and the CreateCluster tool give me an error: "Database ... not found, either pre-create it or allow remote database creation

How can fix this?

Evgenij Ryazanov

unread,
Dec 5, 2020, 12:28:21 AM12/5/20
to H2 Database
Hello.

The cluster support is unmaintained for years and can have any issues.

Here you need to add -ifNotExists parameters to your TCP servers and make sure they aren't available outside of your network, because combination of -tcpAllowOthers with -ifNotExists effectively creates a remote security hole in your system; everyone who can connect to your server can execute any commands on it.

After initialization of cluster it would be better to restart its nodes without this additional parameter for more safety.

Current behavior looks like a bug. I filled a new issue about it:


Reply all
Reply to author
Forward
0 new messages