← Todos os guias
CockroachDB
A distributed SQL database that speaks the PostgreSQL wire protocol — built from the ground up for automatic sharding, replication, and surviving node failures without manual failover work.
Destino: Any Docker hostdistributed-SQLPostgreSQL-compatibleDockerSite oficial ↗Documentação oficial ↗
Este guia foi elaborado a partir da documentação oficial do CockroachDB, ligada acima — verifique sempre lá os nomes exatos dos pacotes/versões antes de executar estes comandos num servidor de produção, uma vez que as versões da distribuição e do projeto mudam com o tempo.
1Run a single-node instance
A single node is enough to try CockroachDB locally; production deployments run 3+ nodes for real replication and fault tolerance.
docker run -d \ --name cockroachdb \ -p 26257:26257 -p 8088:8080 \ -v ./cockroach/data:/cockroach/cockroach-data \ --restart unless-stopped \ cockroachdb/cockroach:latest start-single-node --insecure2Open the built-in admin UI
http://your-server-ip:80883Connect with any PostgreSQL client
Because CockroachDB implements the PostgreSQL wire protocol, the standard `psql` client and most PostgreSQL drivers/ORMs work against it with no special adapter.
docker exec -it cockroachdb ./cockroach sql --insecureThe --insecure flag is fine for local testing only -- a real deployment should generate TLS certificates and set up proper authentication, covered in CockroachDB's production-deployment docs.