Awesome
README
In many case, the master does not allow we use the SSH tunnel for connection between servers.
In order to bypass limit, I designed the light weight remote shell suite, which as SSH working with Tsung nodes, and working well.
How To Use it
First of all, you should git clone https://github.com/weibomobile/tsung_rsh.git
your server :))
1. Starting the rsh_daemon.sh
1). rsh_daemon.sh
Usage
Usage: rsh_daemon.sh <options> start|stop|status|restart
Options:
-a <hostname/ip> allow only given hosts to connect to the server (default is tsung_master)
-p <port> use the special port for listen (default is 19999)
-s <the_erl_path> use the special erlang's erts bin path for running erlang (default is blank)
-h display this help and exit
NOTE:
- The allowed given hosts should be the Tsung master's hostname/IP, and can solved it
- Do not modified the listening port default value 19999, unless you wang to change, then don't forget to modified the
rsh_client.sh
's PORT value
Within the Tsung nodes server, starting it:
sh rsh_daemon.sh -a tsung_master start
The Mac OS does not support assign multi values for
-a
parameters.
2). The tmp _tmp_rsh_filter.sh
file
The _tmp_rsh_filter.sh
(~/tmp/_tmp_rsh_filter.sh) generated by rsh_daemon.sh
file every time when start.
The script just for executing the client's command:
- Receive
ping
, outputpong
- Executing the
erl
command
3). You can assign the Erlang Runtime path
For some reason, We don't need install the Erlang at any server, maybe we can just copy (or use the rsync
) the installed (maybe installed by kerl) Erlang erts dir into the target/slave server.
The -s
parameter can help you :
sh rsh_daemon.sh -s /root/.tsung/erlang/r18.1/bin -a 127.0.0.1 start
When get tsung_controller start the slave's command:
erl -detached -noinput -master tsung_controller@tsung_master -sname tsung8@node136 ...
Then the daemon script will do:
exec /root/.tsung/erlang/r18.1/bin/erl -detached -noinput -master tsung_controller@tsung_master -sname tsung8@node136 ...
4). How debug the rsh daemon server ?
First of all, starting the daemon :
sh rsh_daemon.sh -a 127.0.0.1,tsung_master start
Just use the nc
or ncat
build-in command as one simulator client:
nc 127.0.0.1 19999
Then type ping
and entry, you will get pong
response.
Now, start the remote Erlang Shell:
ncat 127.0.0.1 19999
Type the command :
erl -sname foo
You will get output, and you can have a try now.
Eshell V7.1 (abort with ^G)
(foo@weibomobile)1>
2. Starting Tsung with rsh_client.sh
tsung -r /the_path/rsh_client.sh -f tung.xml
rsh_client.sh
with the target host's port is 19999
Summary
The project is to replace the SSH for Tsung Clusters, and it do now :))