利用 telnet 調試 skynet

目錄  

一、安裝 telnet
      1、安裝必要軟件包
      2、配置修改
二、重啓服務
      1、超級守護進程
      2、23端口
三、啓動 skynet 控制檯服務
四、telnet 連接

五、skynet 命令行


一、安裝 telnet

    1、安裝必要軟件包

yum install -y memcached
yum install -y telnet
yum install -y telnet-server

2、配置修改

vi /etc/xinetd.d/telnet
disable = no
二、重啓服務

    1、超級守護進程

     xinetd 提供了訪問控制、加強的日誌和資源管理功能,已經成了Red Hat 7 和 Mandrake 7.2 的 Internet 標準超級守護進程。它用於管理多種輕量級的 Internet 服務,如 telnet、fp。

[root@localhost /]# service xinetd restart
Stopping xinetd:                                           [  OK  ]
Starting xinetd:                                           [  OK  ]
    2、23端口

     telnet 的端口號是23。利用 netstat 檢查 是否正常啓動。

[root@localhost /]# netstat -tnlp

三、啓動 skynet 控制檯服務

skynet.newservice("debug_console",8000)

四、telnet 連接

[root@localhost ~]# telnet 127.0.0.1 8000
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Welcome to skynet console
    telnet 輸入 IP 和 端口,看到 "Welcome to skynet console" 就代表連接成功了。然後就可以調用各種命令進行性能分析了。

五、skynet 命令行

    首先,來看下最簡單的命令 help,同時也可以預覽下這個控制檯究竟有哪些可以用的功能。

help
call    call address ...
clearcache      clear lua code cache
cmem    Show C memory info
debug   debug address : debug a lua service
exit    exit address : kill a lua service
gc      gc : force every lua service do garbage collect
help    This help message
info    info address : get service infomation
inject  inject address luascript.lua
kill    kill address : kill service
list    List all the service
log     launch a new lua service with log
logoff  logoff address
logon   logon address
mem     mem : show memory status
ping    ping address
service List unique service
shrtbl  Show shared short string table info
signal  signal address sig
snax    lanuch a new snax service
start   lanuch a new lua service
stat    Dump all stats
task    task address : show service task detail
<CMD OK>

    如果命令執行成功,會輸出 <CMD OK>。

更多命令可以參見官方wiki:https://github.com/cloudwu/skynet/wiki/DebugConsole


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章