我开始使用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但是,当我尝试在go应用程序中使用voltdb-client-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)。
发布于 2019-05-30 18:42:53
在hello_word中,它使用localhost:21212作为连接字符串,所以我只是跟随并将192.168.1.4:21212
但它应该是
voltdb://192.168.1.4:21212它修复了连接问题。
https://stackoverflow.com/questions/56376308
复制相似问题