This is a master class about Tarantool Cloud.
Star, share, raise issues and send pull requests :)
Here you will find key commands I eneted on my notebook during the demo, as well as any reference materials we will be going over.
This will run Tarantool and immediately put you into command-line prompt.
docker run --rm -t -i tarantool/tarantool
Press ^C to exit.
To do what I just did, you will need to install Docker:
- On Linux
- On Mac (Installer)
- On Windows (Installer)
docker run --rm -t -i -p 3301:3301 tarantool/tarantool
And then connect to port 3301 on localhost!
docker run --rm -t -i tarantool/tarantool:1.7
or
docker run --rm -t -i tarantool/tarantool:1.5
docker run --rm -t -i -e TARANTOOL_SLAB_ALLOC_ARENA=0.7 tarantool/tarantool
Save the following as docker-compose.yml
:
version: '2'
services:
tarantool1:
image: tarantool/tarantool:1.7
environment:
TARANTOOL_REPLICATION_SOURCE: "tarantool1,tarantool2"
networks:
- mynet
ports:
- "3301:3301"
tarantool2:
image: tarantool/tarantool:1.7
environment:
TARANTOOL_REPLICATION_SOURCE: "tarantool1,tarantool2"
networks:
- mynet
ports:
- "3302:3301"
networks:
mynet:
driver: bridge
And then run:
docker-compose up
You will have 2 containers with Tarantool 1.7 with master-master replication.
Go to http://tarcl1.dev.mail.ru. (Sorry guys, only internal page at this time)
Press "Create" and wait for 20 seconds. You will get a fault-tolerant memcached instance.
I will be using Python, but you can use any language.
easy_install pymemcache
Then write the following python code (replace 10000
with your own port):
from pymemcache.client.hash import HashClient
client = HashClient([
('tarcl1.dev.mail.ru', 10000),
('tarcl2.dev.mail.ru', 10000)
])
client.set('some_key', 'stored value')
result = client.get('some_key')
print(result)
2 services:
- tarantool/cloud: an Instance Manager
- mailru/cloud-exposer: Load-Balancer-As-A-Service (not open-source for now)
The 'exposer' is needed to automatically reroute traffic from broken to live instances. Everything else is done with Instance Manager.
Clone the repository
git clone https://github.com/tarantool/cloud.git
cd cloud
Now use docker-compose to run the cloud:
docker-compose up
In a few seconds, go to http://localhost:5061 and try creating Tarantool instances.
./taas -H localhost:5061 run --name myinstance 0.3
There are solutions for sharding and dynamic code reloading, but they don't give you the full solution. We will change that.
So, in future cloud project will give you:
- Tarantool binary protocol
- Transparent horizontal scaling
- Code deployment (blue/green and feature flags)
- App marketplace