-
Notifications
You must be signed in to change notification settings - Fork 276
Support Inject cluster topology information for am and grafana to etcd in pd #1124
Support Inject cluster topology information for am and grafana to etcd in pd #1124
Conversation
rolling_update.yml
Outdated
@@ -168,6 +168,12 @@ | |||
pd_cert_dir: "{{ pd_cert_dir }}" | |||
when: pd_leader_name == pd_name | |||
|
|||
- name: init pd cluster topology | |||
delegate_to: localhost | |||
shell: "python init-pd-topo.py --pd_host {{ pd_host }} --pd_port {{ pd_port }} --tidb_host {{ tidb_host }} --tidb_port {{ tidb_port }} --grafana_host {{ grafana_host }} --grafana_port {{ grafana_port }} --alertmanager_host {{ alertmanager_host }} --alertmanager_port {{ alertmanager_port }}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this way, no information other than the pd node can be obtained.
Does it need to delete related information from |
|
How to delete the information stored in PD if a node is deleted from the cluster. |
Because the messages will be store in etcd api, we can visit and find it in dashboard. Ansible may not need to care about it. |
I have tested this pr, and it can write value into pd's etcd now. You may see it in 172.16.6.62. Just visit it using:
It's available. |
scripts/init-pd-topo.py
Outdated
"key": encoded_key, | ||
"value": encoded_value, | ||
}) | ||
req = urllib2.Request('http://' + etcd_url + '/v3/kv/put', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this break TLS deployment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At present, this script does not support TLS
, and it needs to be optimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@breeswish @liubo0127 maybe we have 2 ways:
- install etcd in pip and get it.
- Using https.
roles/init_pd_topo/tasks/main.yml
Outdated
- name: generate init_pd_topo script | ||
template: | ||
src: "init_pd_topo.sh.j2" | ||
dest: "{{ playbook_dir }}/scripts/init-pd-topo.sh" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this file being ignored?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can't be ignored, it will be executed during start, rolling_update
operation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean should we put it in .gitignore
since it is generated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script is generated when the cluster is deployed. I think it does not need to be added to .gitignore
{% set tidb_ip = hostvars[host].ansible_host | default(hostvars[host].inventory_hostname) -%} | ||
{% set tidb_port = hostvars[host].tidb_port -%} | ||
{% set tidb_path = hostvars[host].deploy_dir -%} | ||
{% set _ = all_tidb.append("%s:%s%s" % (tidb_ip, tidb_port, tidb_path)) -%} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how would you parse the string when you put these together?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameter values are strings separated by ,
.
Signed-off-by: mapleFU <1506118561@qq.com>
Signed-off-by: mapleFU <1506118561@qq.com> # Conflicts: # roles/dashboard-topo/templates/init_pd_topo.sh.j2
Signed-off-by: mapleFU <1506118561@qq.com>
Signed-off-by: mapleFU <1506118561@qq.com>
Signed-off-by: mapleFU <1506118561@qq.com>
# Conflicts: # excessive_rolling_update.yml # rolling_update.yml
Signed-off-by: mapleFU <1506118561@qq.com>
Signed-off-by: mapleFU <1506118561@qq.com>
Signed-off-by: mapleFU <1506118561@qq.com>
I've test it in "172.16.5.34" |
Signed-off-by: mapleFU <1506118561@qq.com>
Signed-off-by: mapleFU <1506118561@qq.com>
Now:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…d in pd (pingcap#1124) * [Init] Initialize pr and create scripts for sending request to pd * [ADD] adding scripts to yml * [Replace] replacing with shell arguments * [Try] trying to testing ansible * [Update] Updating script * update * [FIX] fix wrong api * Add deploy path * [ADD] adding another logic loading * [ADD] adding net/deploy * add all pd info * [Update] Change directory name and update etcd write path. Signed-off-by: mapleFU <1506118561@qq.com> * change init-pd-topo to dashboart topo * [Update] Support `port` field. Signed-off-by: mapleFU <1506118561@qq.com> * [Fix] Fixing errors on scripts. Signed-off-by: mapleFU <1506118561@qq.com> * [Final] Trying to fix all the problems Signed-off-by: mapleFU <1506118561@qq.com> * [Update] update port type. Signed-off-by: mapleFU <1506118561@qq.com> * [FIX] fix bugs for tidb-anisble deploy dir Signed-off-by: mapleFU <1506118561@qq.com> * [Update] Wait until testing. Signed-off-by: mapleFU <1506118561@qq.com> * [Revert] Revert unnescessary changes. Signed-off-by: mapleFU <1506118561@qq.com> * [DONE] Finish dev. Signed-off-by: mapleFU <1506118561@qq.com> * Update start.yml * Update start.yml Co-authored-by: liubo <liubo0127@qq.com>
…rafana to etcd in pd (#1196) * Support Inject cluster topology information for am and grafana to etcd in pd (#1124) * [Init] Initialize pr and create scripts for sending request to pd * [ADD] adding scripts to yml * [Replace] replacing with shell arguments * [Try] trying to testing ansible * [Update] Updating script * update * [FIX] fix wrong api * Add deploy path * [ADD] adding another logic loading * [ADD] adding net/deploy * add all pd info * [Update] Change directory name and update etcd write path. Signed-off-by: mapleFU <1506118561@qq.com> * change init-pd-topo to dashboart topo * [Update] Support `port` field. Signed-off-by: mapleFU <1506118561@qq.com> * [Fix] Fixing errors on scripts. Signed-off-by: mapleFU <1506118561@qq.com> * [Final] Trying to fix all the problems Signed-off-by: mapleFU <1506118561@qq.com> * [Update] update port type. Signed-off-by: mapleFU <1506118561@qq.com> * [FIX] fix bugs for tidb-anisble deploy dir Signed-off-by: mapleFU <1506118561@qq.com> * [Update] Wait until testing. Signed-off-by: mapleFU <1506118561@qq.com> * [Revert] Revert unnescessary changes. Signed-off-by: mapleFU <1506118561@qq.com> * [DONE] Finish dev. Signed-off-by: mapleFU <1506118561@qq.com> * Update start.yml * Update start.yml Co-authored-by: liubo <liubo0127@qq.com> * Support Prometheus in for dashboard topology (#1195) * [Support] change tidb-ansible script in tidb-ansible. Signed-off-by: mapleFU <1506118561@qq.com> * [ADD] Adding supports in roles. Signed-off-by: mapleFU <1506118561@qq.com> * [Multiple] pass the first when there is multiple arguments. Co-authored-by: mwish <1506118561@qq.com>
This pr is related to this technical design: https://docs.google.com/document/d/10YvHeWeXyWbCIbqXJ_TsGV5pwPXJOaOjE8whd4JSJVE/edit
It want to write address of tidb/grafana/tikv into pd using etcd v3 api. It will be done in
start
androlling_update
phase.