This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
HP ATGHP's Advanced Technology Group for Open Source and Cloud embraces a vision that is two steps ahead of today's solutions. We use this vision to drive product adoption and incubate technologies to advance HP. Through Open Source initiatives we foster collaboration across HP and beyond.
• Vmware – fusion or workstation. ESXi should work too.• https://github.com/CaptTofu/mysql_replication_kubernetes.git• https://github.com/CaptTofu/kubernetes_cluster_vmware.git• Go -- brew install go (or https://golang.org/doc/install)Clients:• etcdctl: go get github.com/coreos/etcd/etcdctl• fleetctl: go get github.com/coreos/fleet/fleetctl • kubectl –
•Operating-system-level virtualization•Encapsulated, hermetically sealed applications•Relatively isolated•Small footprint•Fast to launch!•Portable. And did I mention, portable?!•Use of host OS and Kernel•Execution consists of time to startup application in question•LXC, Docker, Solaris Zones, BSD Jails, Parallels Virtuozzo, OpenVZ, …
1 first process the kernel starts known as “System Docker,”• Flocker (https://clusterhq.com)• Spotify Helios (https://github.com/spotify/helios) Zookeeper• Flynn (https://flynn.io/)• Deis (http://deis.io)• Maestro (https://github.com/toscanini/maestro)• Shipyard (http://shipyard-project.com)• … others to come!
• Minimalist Linux• Optimized for containers• Easy to run containers• Service discovery, container management, • Docker -- Container runtime and management, though Rocket long-
term• Etcd – distributed global key value store for config data on each
node• Fleet – Rudimentary Scheduler interacts with systemd and etcd• Systemd – Newer Linuxi – system and service manager for Linux• Flannel – Networking across nodes
• “An open source system for managing containerized applications across multiple hosts, providing basic mechanisms for deployment, maintenance, and scaling of applications.”
• Pre-Production Beta • Lean• Portable – will run cloud, bare metal, hybrid, etc• Extensible – using modular design allowing for plug-ability and hooks• Self-healing – auto-placement, auto-restart, auto-replication• Google engineering bring good work to the Open-source world
•kube-apiserver – API Server (RESTful)– primary management for cluster– reconciles etcd entries with deployed containers
•kube-controllermanager — Controller Manager Server– Handle replication precesses defined by replication tasks– Writes details to etcd– Monitors changes and implements procedure to reflect the change
•kube-scheduler -- Scheduler Server– Assigns workloads to specific minions in cluster taking into account
service’s operating requirements and infrastructure environment •kube-register -- Register Server
•Kubelet Kubelet– Communicates with the master, relaying information to/from– Reads and updates etcd– Receives work in a manifest that defines the workload and
operating parameters. – Assumes responsibility for the state of work on minion
•kube-proxy Kube proxy– Ensures network environment is accessible but isolated. – Makes services available externally by forwarding requests to
containers.– Can perform rudimentary load balancing.
• Group of closely-related containers on the same host• Service
• Virtual abstraction• Basic load-balancer• Single consistent access point to a pod
• Replication controller• Defines pods to be horizontally scaled• Uses a label query for identifying what containers to run • Maintains specified number of replicas of a particular thing to run• Dynamic resizing
• Label • Key/value tag to mark work units a part of group• Management and action targeting
• Definition file – YAML/json describing a pod, service, or replication controller
MySQL async replication on Kubernetes• Simple proof of concept• Master pod and service• Slave pod and service• Secret sauce?
• The master pod configuration file passes environment variables to set root password, replication password
• The entrypoint script runs an SQL file to grant permissions to replication user
• The master service configuration is loaded and the slave pod container(s) have as an environment variable MYSQL_MASTER_SERVICE_HOST set
• Slave pod when launched has environment variables for replication user and password passed and along with MYSQL_MASTER_SERVICE_HOST variable, changes the master host and user to point to that master
Vitess• YouTube – since 2011• Vitess from french “Vitesse” for fast. Came about because of cat movies (remember
Gearman?)• Backed by consistent data store (etcd, Chubby, Zookeeper)• Clients with simple interface to provide a view of a single instance• Lightweight connections (around 32kb) using BSON-based protocol• Row cache• SQL Parser the uses a configurable set of rules to rewrite queries • Sharding and shard management built-in:
• range based, supports horizontal and vertical sharding• can accommodate your existing sharding scheme• Supports split replication stream (keyspace ID in statement-based replication stream)
• Handles failover and backups• Includes a proxy to route queries to most appropriate MySQL instance • Supports transactions within a shard, plans to support cross-shard transactions using two
Vitess components, topology server (cont)• Topology server – used to store information about keyspaces,
shards, tablets, replication graph, and serving graph. Also supports watch interface for changes on a node
• Local instance (per cell) -- Tablet record contains information about both vtablet process and MySQL process. Contains tablet alias (cell + unique ID), hostname, IP, Port, Tablet type, Which keyspace/shard the tablet is part of, health map, sharding key range. Note that a tablet record is created before it is run
• Replication Graph – what clients use to find what endpoints to send queries to. The objects are:
• SrvKeySpace – local representation of a Keyspace containing information about what shard to use to access data
• SrvShard – local representation of a Shard, details internal only to this shard