NewSQLã®TiDBããã¼ã«ã«ã«ç«ã¦ã¦ã¿ã
34. NewSQLとは w/ tzkb | fukabori.fm ãèãã¦NewSQLããã¼ã«ã«ã§è©¦ãã¦ã¿ãããªã¨æã£ã¦èª¿ã¹ã¦ã¿ãã
ç´¹ä»ããã¦ãã®ã¯Spanner以å¤ã§3ã¤ã»ã©ãã£ããã©ããã触ãæ©ä¼ãããMySQLã«äºæãããTiDBãé¸æã æåã« Quick Start Guide for the TiDB Database Platform | PingCAP Docs ãè¦ãªããæ§ç¯ãããã¨ãã¦ãããã©ãã¡ãã£ã¨è©¦ãã¦ããæ¶ãããã®ã§ãã¼ã«ã«ã«è²ã å ¥ããã®ã¯é¿ãããã£ãã ãã¼ã«ã«ã®k8sã«ãããã¤ãã¦ç¢ºèªãçµãã£ããã¯ã©ã¹ã¿ãªã»ãããããããªæãã§è©¦ããªããã¨èª¿ã¹ã¦ã¿ã¦ããã¨helm chartãæä¾ããã¦ãããã¨ãçºè¦ã
Deploy TiDB in the Minikube Cluster | PingCAP Docs ã®ããã*1ãè¦ãã¨ãããã¥ã¡ã³ãã«è¨è¼ããã¦ããã®ã¯kind/GKE/minikubeã§ãæå ã§è©¦ãããã£ããã©kindãminikubeãå ¥ããã®ãé¢åã ã£ãã®ã§docker-desktopã¯ã©ã¹ã¿ã«ãããã¤ãè¡ã£ã¦ã¿ãã ä¸é¨ããã¥ã¡ã³ããå¤ãããªé°å²æ°*2ã®ã¨ããã ãæå ã§å¾®ä¿®æ£ãã¤ã¤ãããã¤ãå®è¡ããã³ãã³ãã¯é常ã«ã·ã³ãã«ã ã¡ãªã¿ã«helmã®ãã¼ã¸ã§ã³ã¯v3.2.4ã使ã£ãã
kubectl create ns tidb-admin helm repo add pingcap https://charts.pingcap.org/ kubectl apply -f https://raw.githubusercontent.com/pingcap/tidb-operator/master/manifests/crd.yaml helm upgrade tidb-operator pingcap/tidb-operator -i --wait -n tidb-admin helm upgrade tidb-cluster pingcap/tidb-cluster -i --wait -n tidb-admin \ --set schedulerName=tidb-scheduler,pd.storageClassName=hostpath,tikv.storageClassName=hostpath,pd.replicas=1,tikv.replicas=1,tidb.replicas=1,monitor.create=true,monitor.grafana.create=true
ãã æå¾ã«tidb-clusterããããã¤ããã¨ãã«ã¨ã©ã¼ãåºãã
Error: UPGRADE FAILED: template: tidb-cluster/templates/monitor-secret.yaml:1:7: executing "tidb-cluster/templates/monitor-secret.yaml" at <(.Values.monitor.create) and (.Values.monitor.grafana.create)>: can't give argument to non-function .Values.monitor.create
https://github.com/pingcap/tidb-operator ã®chartãã¡ã¤ã«ãè¦ãã¨monitor-secret.yamlã§ifã®æ¸ãæ¹ã誤ã£ã¦ãããããªæ°ãããã®ã§*3ãæå ã«cloneãã¦ãããä¿®æ£ã ä¿®æ£ããchartã§è©¦ãã¨ãããã¤ãã§ããããã«ãªã£ãã ç¾å¨ã¯ãã®åé¡ã¯ä¿®æ£ããã¦ããã¯ãã (2020/7/7追è¨)
ããã¥ã¡ã³ãã¨ã®å·®ç°ã¯
- tidb-operator chartããããã¤ããã¨tidb-schedulerãå ¥ã£ã¦ããã®ã§schedulerNameãæå®
- docker-desktopã使ã£ã¦ããã®ã§storageClassNameãhostpathã«å¤æ´
schedulerNameã¯ããã¥ã¡ã³ãã«è¨è¼ããã¦ããéããdefault-schedulerã«ãã¦ããã¦ãç¹ã«åé¡ã¯ãªãã£ãã
ãããã¤å¾ã«æå ã§è»½ãéãã§ã¿ãã
# http://localhost:2379/dashboard ã§Dashboardãè¦ãã kubectl port-forward svc/tidb-cluster-pd 2379 # http://localhost:3000 ã§Grafanaãè¦ãã kubectl port-forward svc/tidb-cluster-grafana 3000 # mysql -h 127.0.0.1 -P 4000 -u root -D test ã§TiDBã«ç¹ãã kubectl port-forward -n tidb-admin svc/tidb-cluster-tidb 4000
ãããã¤æã«monitorãæå¹åãã¦ããã¨Prometheus/Grafanaããããã¤ããã¦ãã¦ãæåããããæãã®ããã·ã¥ãã¼ããæä¾ãã¦ããã¦ããã ããã¨ã¯å¥ã«TiDBãç¬èªã«ä½ã£ãããã·ã¥ãã¼ãããã£ãã MySQL Clientã§ç¹ãã®ãä½ããã©ãã«ããªãæ®éã«SQLãå©ããã
å°ãchartã«ä¿®æ£ãå ¥ããã¨ã¯ããã大ããªãããã¯ããç°å¢æ±æããªããã¼ã«ã«ã§ãã£ã¨åãã®ã¯æåããã ãã¨ãã¨ãªã³ãã¬ã®ãã¼ã¿ã»ã³ã¿ã¼ãéç¨ãã¦ããä¼ç¤¾ã¨ãã§Writeãã¹ã±ã¼ã«ããDBã欲ãããªã£ãã±ã¼ã¹ãªã©ã«ã¯ãããæå¹ãããªãããã¯ãã ãªã¨æããã ãã¨ã¯OSSãªã®ã§ä½ãåé¡ã«ããã£ãã¨ãã«issueãè¦ã¦å¨ãã«åãç¾è±¡ã®äººãããããã確èªã§ããããå®è£ ãè¦ã¦PRãæãããã§ããã®ãè¯ãããã
EKSãGKEã§productionã¨ãã¦ä½¿ãå ´åã®terraformãã¡ã¤ã«ãªã©ãæä¾ããã¦ãããCloudã§ä½¿ãå§ããã®ãããªã楽ãããªå°è±¡ããã£ãã å®ééç¨ãå§ããã¨ãã¼ã¸ã§ã³ã¢ãããé«è² è·æã®ããããããªãæåã«æ©ã¾ãããã¨ãã£ããã¨ã¯ãã£ã¨ãããã ãããã©ããããã¯ãªãªãã£ãé«ããªã¨æããã å©ç¨è ãå¢ãã¦ããã¨ãã°ã¯å©ããã¦ããã®ã§æ¬å½ã«ããã¼ã¸ããµã¼ãã¹ã使ãæè¦ã§TiDBãé¸æè¢ã«å ¥ããããæªæ¥ãããã®ãããããªãã
ãã®æã®å·¨å¤§ããã¸ã§ã¯ãã¯æå ã«ãããããªä¾åç©ãå ¥ããªããç°å¢ãä½ããéã³çµãã£ã¦ãæå ã®ä¾åç©ãæ®ãç¶ããã¿ãããªãã¨ããããã¡ã ãã©ã k8sã¨helmãããã°ãµã¯ãã¨è©¦ãã¦ãµã¯ãã¨Resetã§ãããããªä¸ç観ãªã®ãä½æããããè¯ãã£ãã