方法一:
使用tiup playground快速部署本地測試環境
#宣告全域性變數
source ~/.bash_profile
#在當前session執行以下命令啟動集群
tiup playground --預設監聽本地服務,若開通外網訪問許可權,可以通過指定--host 0.0.0.0
##也可以指定tidb版本以及各元件例項個數
##tiup playground v4.0.0 --db 2 --kv 3 --monitor #monitor表示同時部署監控元件
結果輸出訪問方式
cluster start successfully, enjoy it ^-^
to connect tidb: mysql --host 127.0.0.1 --port 4000 -u root
to view the dashboard:
to view the prometheus:
to view the grafana:
在不指定host的情況下,也可使用nginx做埠**
server
location /dashboard
方法二:
2. 使用tiup cluster在單機上模擬生產環境部署
2.1 基本架構
例項 個數 ip 配置
tikv 3 127.0.0.1 避免埠衝突和目錄衝突
tidb 1 127.0.0.1 預設埠全域性目錄配置
pd 1 127.0.0.1 預設埠全域性目錄配置
tiflash 1 127.0.0.1 預設埠全域性目錄配置
monitor 1 127.0.0.1 預設埠全域性目錄配置
2.2 安裝元件
#安裝tiup
#安裝tiup的cluster元件
tiup cluster
#修改/etc/ssh/sshd_config ,將maxsessions 調至20
service sshd restart
2.3 建立並啟動集群
配置模板
user: 表示通過tidb這系統使用者作為集群的內部管理
replication.enable-placement-rules: 設定這個pd引數來確保tiflash正常執行
host: 設定為本部署主機的ip
hostip:設為本機ip
# # the deployments if a specific deployment value is missing.
global:
user: "tidb"
ssh_port: 22
deploy_dir: "/tidb-deploy"
data_dir: "/tidb-data"
monitored:
node_exporter_port: 9100
blackbox_exporter_port: 9115
server_configs:
tidb:
log.slow-threshold: 300
tikv:
readpool.storage.use-unified-pool: false
readpool.coprocessor.use-unified-pool: true
pd:replication.enable-placement-rules: true
replication.location-labels: [
"host"
] tiflash:
logger.level: "info"
pd_servers:
- host: hostip
tidb_servers:
- host: hostip
tikv_servers:
- host: hostip
port: 20160
status_port: 20180
config:
server.labels:
- host: hostip
port: 20161
status_port: 20181
config:
server.labels:
- host: hostip
port: 20162
status_port: 20182
config:
server.labels:
tiflash_servers:
- host: hostip
monitoring_servers:
- host: hostip
grafana_servers:
- host: hostip
執行集群部署命令
##user root -p --tidb-version可通過tiup list tidb檢視支援部署的版本
tiup cluster deploy
./topo.yaml
啟動集群
tiup cluster start
訪問方式同方法一
詳情請參考pingcap官方文件
tidb的docker部署(低配版 測試用)
tidb 簡介 tidb 是 pingcap 公司設計的開源分布式 htap hybrid transactional and analytical processing 資料庫,結合了傳統的 rdbms 和 nosql 的最佳特性。tidb 相容 mysql,支援無限的水平擴充套件,具備強一致性和...
elasticsearch環境部署測試
共享模式下 useradd sxt echo sxt passwd stdin sxt su sxt root 使用者建立 opt sxt es 普通使用者無法建立 mkdir p opt sxt es 注意 此時的目錄許可權屬於root 在附近目錄尚學堂下執行 chown sxt sxt es 單...
ElasticSearch環境部署測試
問題排查可以登入論壇查詢相關資訊 一 安裝elasticsearch 1.安裝elasticsearch集群 修改配置檔案config elasticsearch.yml 如果要配置集群需要兩個節點上的elasticsearch配置的cluster.name相同,都啟動可以自動組成集群,這裡如果不改...