Не удается подключиться к VoltDB по сети - PullRequest
0 голосов
/ 30 мая 2019

Я начинаю с VoltDB.Запуск VoltDB сообщества на сервере в локальной сети.Инициализация сервера завершена, как сообщается после запуска сервера

Build: 9.0 voltdb-9.0-0-g6aae38a-local Community Edition
Loaded node-specific settings from voltdbroot/config/path.properties
Connecting to VoltDB cluster as the leader...
Host id of this node is: 0
Restarting the database cluster from the command logs
WARN: User authentication is not enabled. The database is accessible and could be modified or shut down by anyone on the network.
Partition placement has been restored.
Initializing the database. This may take a moment...
WARN: This is not a highly available cluster. K-Safety is set to 0.
WARN: Durability is turned off. Command logging is off.
Restoring from path: /home/samtech/voltdb-db/voltdbroot/snapshots with nonce: SHUTDOWN_20190530T151422_my4epdwk9mv4
Duplicate rows will be output to: /home/samtech/voltdb-db/voltdbroot/snapshots nonce: SHUTDOWN_20190530T151422_my4epdwk9mv4
Finished restore of /home/samtech/voltdb-db/voltdbroot/snapshots with nonce: SHUTDOWN_20190530T151422_my4epdwk9mv4 in 0.09 seconds
Server Operational State is: NORMAL
Server completed initialization.

Я могу подключиться к серверу локально, либо с

sqlcmd --servers=192.168.1.4

, либо с помощью

sqlcmd

Но когдая попытался подключиться с помощью voltdb-client-go в моем приложении go, оно показывает следующую ошибку

No valid connections failed to connect to server 192.168.1.4

Вот мой код, который я пытаюсь

package main

import (
    "database/sql"
    "log"

    _ "github.com/VoltDB/voltdb-client-go/voltdbclient"
)

func main() {
    InitVDb()
}

func InitVDb() {
    VDb, err := sql.Open("voltdb", "192.168.1.4")
    if err != nil {
        log.Fatalf("Voltdb Connection error %v\n", err)
    }

    err = VDb.Ping()
    if err != nil {
        VDb.Close()
        log.Fatalf("Ping failed: %v\n", err)
    }

    log.Println("Connection suceeded...")
}

Я также пытался с«192.168.1.4:21212», но получаю ту же ошибку.Что не так в коде?

На компьютере базы данных нет брандмауэра (ipconfig).

1 Ответ

1 голос
/ 30 мая 2019

В hello_word он использовал localhost:21212 в качестве строки подключения, поэтому я просто последовал и поставил 192.168.1.4:21212

Но это должно быть

voltdb://192.168.1.4:21212

Исправлена ​​ошибка соединения.

...