Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support debug and ctop commands in CLI #387

Merged
merged 15 commits into from
Apr 17, 2019
Merged

Conversation

aylei
Copy link
Contributor

@aylei aylei commented Apr 12, 2019

This PR add debug and ctop commands in the CLI, some examples:

$ tkc list -A
NAMESPACE            NAME                 PD    TIKV   TIDB   AGE
stability-cluster1   stability-cluster1   3/3   3/3    2/2    26h

$ tkc use -n=stability-cluster1 stability-cluster1
Tidb cluster switched to stability-cluster1/stability-cluster1

$ tkc get tikv
NAME                        READY   STATUS    MEMORY          CPU   RESTARTS   AGE   NODE
stability-cluster1-tikv-0   2/2     Running   2098Mi/4196Mi         0          26h   172.16.4.153
stability-cluster1-tikv-1   2/2     Running   2098Mi/4196Mi         0          26h   172.16.4.151
stability-cluster1-tikv-2   2/2     Running   2098Mi/4196Mi         0          26h   172.16.4.150

# Now, assume that stability-cluster1-tikv-0 is unhealthy, we can use `ctop` to view the real-time metrics
$ tkc ctop stability-cluster1-tikv-0
# Or see the node metrics of tikv-0
$ tkc ctop node/172.16.4.153

# If the problem still exists, we can debug the tikv instance
$ tkc debug stability-cluster1-tikv-0 

████████╗██╗██████╗ ██████╗      ██████╗████████╗██╗
╚══██╔══╝╚═╝██╔══██╗██╔══██╗    ██╔════╝╚══██╔══╝██║
   ██║   ██╗██║  ██║██████╔╝    ██║        ██║   ██║
   ██║   ██║██║  ██║██╔══██╗    ██║        ██║   ██║
   ██║   ██║██████╔╝██████╔╝    ╚██████╗   ██║   ███████╗
   ╚═╝   ╚═╝╚═════╝ ╚═════╝      ╚═════╝   ╚═╝   ╚══════╝

Welcome to tidb cluster control! (https://github.com/pingcap/tidb)

→ / ps -ef
PID   USER     TIME  COMMAND
    1 root      3:52 /tikv-server --pd=stability-cluster1-pd:2379 --advertise-a
  103 root      0:00 bash -l
  112 root      0:00 ps -ef

# we may chroot the tikv container's root filesystem
→ / chroot /proc/1/root

→ / ls
bin            home           mnt            sbin           tmp
dev            lib            proc           srv            usr
entrypoint.sh  lib64          root           sys            var
etc            media          run            tikv-server

I will open another PR to add more documents and tests.

Signed-off-by: Aylei rayingecho@gmail.com

aylei added 11 commits March 12, 2019 16:14
Signed-off-by: Aylei <rayingecho@gmail.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
aylei added 3 commits April 12, 2019 21:41
Signed-off-by: Aylei <rayingecho@gmail.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
Signed-off-by: Aylei <rayingecho@gmail.com>
@aylei
Copy link
Contributor Author

aylei commented Apr 17, 2019

/run-e2e-tests

@aylei
Copy link
Contributor Author

aylei commented Apr 17, 2019

@tennix @weekface @xiaojingchen PTAL again

@weekface
Copy link
Contributor

This looks good to me.

Copy link
Member

@tennix tennix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants