How to Configure Vitess Read Only User

Published
Length
3 min read

Luis Felipe Dias

All posts

You set up a vitess read only user by defining credentials at the query routing layer and routing sessions to replica tablets. You also grant read permissions on the underlying MySQL database instances. Teams often start by sharing a single primary database account for debugging. Broad accounts create big risks because any team member can change production rows. How to set up a vitess read only user Vitess splits client traffic from the storage layer by using stateless routing nodes. When a p

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

You set up a vitess read only user by defining credentials at the query routing layer and routing sessions to replica tablets. You also grant read permissions on the underlying MySQL database instances. Teams often start by sharing a single primary database account for debugging. Broad accounts create big risks because any team member can change production rows.

How to set up a vitess read only user

Vitess splits client traffic from the storage layer by using stateless routing nodes. When a person or app logs in, the router checks the user list. This list lives in a static file or a central directory service. After the router checks the password, it matches the account to internal groups.

To lock an account to reads, you use table access rules and tablet routing. First, you set up table access rules that link user groups to permissions. Vitess sorts SQL statements into reader, writer, and admin groups. You put your read role into the reader group and block the rest.

Second, you point the user session at replica or analytics tablets. In Vitess, the primary tablet takes writes while replica tablets serve read traffic. When a client logs in and asks for replica tablets, writes fail right away. The underlying MySQL engine also runs in read mode on those replica nodes. This gives your team two layers of safety against bad writes or deletes.

For large clusters, you must sync these rules across every keyspace and shard. Each tablet loads the table access file so it can check incoming requests. If a user tries to run an update, the tablet drops the statement. The router also logs the failed attempt for the security team to review.

Why routing rules alone leave security gaps

Native Vitess rules do a good job of stopping write statements at login. They make sure a support engineer cannot drop a table or change records. Still, static accounts and table rules only decide who can log in. They do not inspect what each select statement pulls back in flight.

Read-Only Root Filesystem + User Provisioning (SCIM): architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

A read role still lets a user pull every row from a customer table by default. That data often holds emails, phone numbers, card numbers, and national IDs. Because the user has full read rights on the table, nothing filters the result. Static passwords for that read role also get shared in chat rooms or scripts. When ten people share one read account, your audit logs lose individual identity.

Managing replica routing and user keys at scale

As your team grows, keeping static user files in sync becomes hard work. Every time an engineer joins or leaves, someone must update the router files. You also have to rotate shared passwords across every tool and dashboard. If you miss one node during an update, old keys keep working.

Teams also struggle with heavy queries that slow down production replica tablets. A careless select statement without a row limit can lock up memory fast. Routing heavy users to batch tablets helps protect live app traffic from slowdowns. Still, tablet routing cannot mask sensitive columns like emails or card numbers. Data masking rewrites matched fields in results so raw values do not leave the cluster.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev sits inline in the protocol beside each supported service as an open-source proxy, a sidecar for your database or API. For every query or command an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human approval.

First, hoop.dev guardrails block banned queries before they run or hold risky ones for review, and hoop.dev data masking rewrites matched sensitive values in responses in memory. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

Where does Vitess check user passwords during login?

The routing layer checks user passwords before it opens a session to any tablet. It reads keys from a local file, a directory server, or client certificates.

What is the difference between replica tablets and batch tablets?

Replica tablets serve live read traffic for apps and can step up as primary. Batch tablets serve heavy analytics queries and never take over as the primary node.

Do table access rules hide sensitive columns like emails or card numbers?

No, native table rules only allow or block whole statements at the table level. They do not rewrite or mask individual columns like phone numbers inside query results.

The query runs. The emails stay hidden.