本文介紹 Kubernetes 支持資料庫等有狀態應用的常見解決方案:StatefulSet,
在構建機器學習向量管理層時,我們面臨的一個重要問題:如何持久化資料以避免資料丟失?
在閱讀了許多資料庫企業發布的博客后,我們認為 StatefulSet[1] 是實作這個目標的可行方法,
我們研究了不同的資料庫,包括 Cockroach、MySQL、MongoDB、Cassandra、PostgreSQL、Dgraph 和 Redis,我們還研究了 Kafka 和 Zookeeper,因為它們都需要持久化狀態,我們選擇這些資料庫是基于兩方面:
- 它們是業界廣泛使用的資料庫解決方案,并可以部署在 Kubernetes 上,其中一些是云原生資料庫,如 Cockroach,
- 這些有狀態應用是不同型別的,比如 MySQL 是關系型資料庫,MongoDB 是非關系型資料庫,研究不同型別的資料庫讓我們對使用 StatefulSet 方案更加自信,
下面列出了一些關于如何使用 StatefulSet 在 Kubernetes 中部署不同資料庫或有狀態應用程式的文章,
Cockroach
- 3 ways to master stateful apps in Kubernetes[2],
Kubernetes 有兩種方法管理狀態:DaemonSet 和 StatefulSet,但是 Cockroach 強烈建議使用 StatefulSet,
- How to Run CockroachDB on Kubernetes[3]Deploy a Local Cluster with Kubernetes[4]
MySQL
- Run a Replicated Stateful Application[5]
- Kubernetes StatefulSet — Example & Best Practices[6]
這篇文章介紹了使用 Kubernetes StatefulSet 部署 MySQL 的端到端流程,
MongoDB
- Running MongoDB on Kubernetes with StatefulSets[7]
- How to Run MongoDB on Kubernetes[8]
Cassandra
- Deploying Cassandra with a StatefulSet[9]
PostgreSQL
- Deploying PostgreSQL as a StatefulSet in Kubernetes[10]
Dgraph[11]
Redis
- Deploying Redis Cluster on Kubernetes[12]
Kafka
- Set-up Kafka Cluster Using Kubernetes StatefulSet[13]
Zookeeper
- Running Zookeeper, A Distributed System Coordinator[14]
基于上述文章,我們將開始使用 StatefulSet,看看它是否能夠滿足我們的應用場景,
原文鏈接:https://medium.com/@junxie2/kubernetes-statefulset-for-db-applications-7fd186c6ccb9
參考參考
1.StatefulSet: https://kubernetes.io/zh-cn/docs/tutorials/stateful-application/basic-stateful-set/
2.3 ways to master stateful apps in Kubernetes:https://www.cockroachlabs.com/blog/kubernetes-orchestrate-sql-with-cockroachdb/
3.How to Run CockroachDB on Kubernetes:https://www.cockroachlabs.com/blog/running-cockroachdb-on-kubernetes/
4.Deploy a Local Cluster with Kubernetes:https://www.cockroachlabs.com/docs/stable/orchestrate-a-local-cluster-with-kubernetes.html
5.Run a Replicated Stateful Application:https://kubernetes.io/docs/tasks/run-application/run-replicated-stateful-application/
6.Kubernetes StatefulSet — Example & Best Practices:https://loft.sh/blog/kubernetes-statefulset-examples-and-best-practices/
7.Running MongoDB on Kubernetes with StatefulSets:https://kubernetes.io/blog/2017/01/running-mongodb-on-kubernetes-with-statefulsets/
8.How to Run MongoDB on Kubernetes:https://kubernetes.io/blog/2017/01/running-mongodb-on-kubernetes-with-statefulsets/
9.Deploying Cassandra with a StatefulSet:https://kubernetes.io/docs/tutorials/stateful-application/cassandra/
10.Deploying PostgreSQL as a StatefulSet in Kubernetes:https://www.bmc.com/blogs/kubernetes-postgresql/
11.Dgraph:https://dgraph.io/docs/deploy/kubernetes/
12.Deploying Redis Cluster on Kubernetes:https://www.containiq.com/post/deploy-redis-cluster-on-kubernetes
13.Set-up Kafka Cluster Using Kubernetes StatefulSet:https://medium.com/@knoldus/set-up-kafka-cluster-using-kubernetes-statefulset-30d73d25864b
14.Running Zookeeper, A Distributed System Coordinator:https://kubernetes.io/docs/tutorials/stateful-application/zookeeper/
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/502682.html
標籤:其他
上一篇:Mysql 一主一從
