Skip to content

A ready-to-use Vitess sharding environment running on Docker Compose. Includes etcd topology service, vtctld control plane, vttablets, VTGate, VTOrc, schema initialization, and automated keyspace/shard setup. Designed for local development, testing, and experimenting with Vitess sharding architecture.

License

Notifications You must be signed in to change notification settings

shyhirt/vitess_docker_sharding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test data

USE commerce;
SHOW TABLES;

INSERT INTO products (product_id, name, price) VALUES
(1, 'Laptop', 999.99),
(2, 'Mouse', 29.99),
(3, 'Keyboard', 79.99),
(4, 'Monitor', 299.99),
(5, 'Headphones', 149.99);

SELECT * FROM products;

-- Customer keyspace (шардированный)
USE customer;
SHOW TABLES;

INSERT INTO customers (customer_id, name, email) VALUES
(1, 'Alice Johnson', '[email protected]'),
(2, 'Bob Smith', '[email protected]'),
(3, 'Charlie Brown', '[email protected]'),
(100, 'Diana Prince', '[email protected]'),
(200, 'Eve Wilson', '[email protected]'),
(300, 'Frank Miller', '[email protected]');

INSERT INTO orders (order_id, customer_id, product_id, quantity) VALUES
(1, 1, 1, 1),
(2, 1, 2, 2),
(3, 2, 3, 1),
(4, 3, 1, 1),
(5, 100, 5, 2),
(6, 200, 2, 3),
(7, 300, 4, 1);

-- Проверьте данные
SELECT * FROM customers ORDER BY customer_id;
SELECT * FROM orders ORDER BY order_id;

-- Проверьте как данные распределены по шардам
SELECT customer_id, name, 
       CASE 
         WHEN customer_id IN (1,2,3) THEN 'shard -80'
         ELSE 'shard 80-'
       END as shard
FROM customers 
ORDER BY customer_id;

-- JOIN между таблицами
SELECT c.name, o.order_id, o.product_id, o.quantity 
FROM customers c 
JOIN orders o ON c.customer_id = o.customer_id
ORDER BY c.customer_id;```

About

A ready-to-use Vitess sharding environment running on Docker Compose. Includes etcd topology service, vtctld control plane, vttablets, VTGate, VTOrc, schema initialization, and automated keyspace/shard setup. Designed for local development, testing, and experimenting with Vitess sharding architecture.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •