We're Hiring!

Mattermost, Inc.

[Solved] Failed to open sql connection Default addr for network '10.1.2.50:5432' unknown

Hi There,

I’ve been trying to set-up mattermost on an Uubuntu server using the production install guide. I have almost reached the steps until setting up mattermost server and I’m stuck in step 8. Below is the error what I get;

root@ahr-web:/home/ahr/mattermost/bin# ./platform
[17:45:56 MVT 2016/05/10] [INFO] (github.com/mattermost/platform/utils.GetTranslationsBySystemLocale:52) Loaded system translations for ‘en’ from ‘/home/ahr/mattermost/i18n/en.json’
[2016/05/10 17:45:56 MVT] [INFO] Current version is 2.2.0 (6671/Fri Apr 15 18:40:19 UTC 2016/8e883ad2f516820942cc0131241268c1ea909ff3)
[2016/05/10 17:45:56 MVT] [INFO] Enterprise Enabled: false
[2016/05/10 17:45:56 MVT] [INFO] Current working directory is /home/ahr/mattermost/bin
[2016/05/10 17:45:56 MVT] [INFO] Loaded config file from /home/ahr/mattermost/config/config.json
[2016/05/10 17:45:56 MVT] [INFO] Server is initializing…
[2016/05/10 17:45:56 MVT] [INFO] Pinging sql master database
[2016/05/10 17:45:56 MVT] [CRIT] Failed to ping db err:Default addr for network ‘10.1.2.50:5432’ unknown
panic: Failed to open sql connection Default addr for network ‘10.1.2.50:5432’ unknown

goroutine 1 [running]:
github.com/mattermost/platform/store.setupConnection(0xcc0a58, 0x6, 0xc820259ba0, 0x5, 0xc8202b0660, 0x56, 0xa, 0xa, 0xc8200b5900, 0xc81fffa4d7)
/go/src/github.com/mattermost/platform/store/sql_store.go:169 +0x894
github.com/mattermost/platform/store.NewSqlStore(0x0, 0x0)
/go/src/github.com/mattermost/platform/store/sql_store.go:61 +0x11c
github.com/mattermost/platform/api.NewServer()
/go/src/github.com/mattermost/platform/api/server.go:35 +0xe8
main.main()
/go/src/github.com/mattermost/platform/mattermost.go:67 +0x74d

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1721 +0x1

goroutine 5 [syscall]:
os/signal.loop()
/usr/local/go/src/os/signal/signal_unix.go:22 +0x18
created by os/signal.init.1
/usr/local/go/src/os/signal/signal_unix.go:28 +0x37

goroutine 235 [chan receive]:
github.com/alecthomas/log4go.(*ConsoleLogWriter).run(0xc820312940, 0x7f5e34f3a1e8, 0xc820026010)
/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/alecthomas/log4go/termlog.go:33 +0x69
created by github.com/alecthomas/log4go.NewConsoleLogWriter
/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/alecthomas/log4go/termlog.go:26 +0xb5

goroutine 236 [select]:
github.com/alecthomas/log4go.NewFileLogWriter.func1(0xc8203c2fa0)
/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/alecthomas/log4go/filelog.go:87 +0xabc
created by github.com/alecthomas/log4go.NewFileLogWriter
/go/src/github.com/mattermost/platform/Godeps/_workspace/src/github.com/alecthomas/log4go/filelog.go:119 +0x38b

goroutine 237 [chan receive]:
database/sql.(*DB).connectionOpener(0xc8203c3040)
/usr/local/go/src/database/sql/sql.go:634 +0x45
created by database/sql.Open
/usr/local/go/src/database/sql/sql.go:481 +0x336

Any advise will be highly appreciated.

Hi azkerm

Looks like your Mattermost server can’t connect to the database server. Can you check that the DB server is setup correctly? Also make sure the database connection string, if your using mysql something like: mmuser:mostest@tcp(dockerhost:3306)/mattermost?charset=utf8mb4,utf8 is in the correct format and has the correct username, password, ip address and port.

Hi There,

Thank you for investing your valuable time on replying to this. Well, I have tried the way of postgres as that’s what the production install guide says… I’m way more convenient doing this on a MySQL… However, I couldn’t find proper documentation than what’s on the official site. However, the pre-test install using the single command work like a charm but would that work on a production?

You can use MySQL just fine. The instructions should work for both as long as you know how to modify them for MySQL. The docker image is not recommended for production.

Hi There!

Thanks for the heads up. I manage to run with PSQL. Thanks