Retry logic for creating cassandra session in vault config

43 views
Skip to first unread message

Saurabh Singh

unread,
Aug 5, 2019, 12:50:19 PM8/5/19
to Vault
Hi,

I am using cassandra as backend for my vault service. Both vault and cassandra are running as containers. 
When I restart vault and cassandra together then cassandra takes couple of minutes to come up.
Vault tries to create session but it fails with error:-
gocql: unable to dial control conn 127.0.0.1: dial tcp 127.0.0.1:9042: connect: connection refused

the reason for this failure is simple- cassandra is still not ready.

My question is is there any way to add a retry logic for creating cassandra session in vault config?

my current config for cassandra as backend:
"backend": {
                "cassandra": {
                        "hosts": "127.0.0.1",
                        "consistency": "LOCAL_QUORUM",
                        "protocol_version": 4,
                        "keyspace": "vault",
                        "table": "entries",
                        "connection_timeout": 10
                }
        }

Thanks and regards
Saurabh

Nick Cabatoff

unread,
Aug 5, 2019, 1:44:48 PM8/5/19
to vault...@googlegroups.com
Hi Saurabh,

Whatever is running your services should restart them on failure, no?  What's wrong with relying on that?

Alternatively, depending on how you're orchestrating your services, you could declare the vault container to be dependent on the cassandra container and the former wouldn't get launched until the latter reports as ready.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/vault/issues
IRC: #vault-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Vault" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vault-tool+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vault-tool/82f7687c-6e79-46a8-8c5e-40c01ebd84ca%40googlegroups.com.

Saurabh Singh

unread,
Aug 5, 2019, 2:13:33 PM8/5/19
to vault...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages