Этот файл содержит неоднозначные символы Юникода, которые могут быть перепутаны с другими в текущей локали. Если это намеренно, можете спокойно проигнорировать это предупреждение. Используйте кнопку Экранировать, чтобы подсветить эти символы.
What is rDSN.Monitor?
rDSN.Monitor
is more than a dashboard. It's cross-layer profiling and diagnosis tool for developers to grasp the current state of system and improve distributed system performance. It's a special app, when launched together with other apps, it will automatically loads profiling other's information.
rDSN.Monitor
is written in Python
.
The code is here.
Sample screenshots:
Install
First of all, you need to install rDSN
and Python2.7
.
Then simply download and build rDSN.Python
what is rDSN.Python
?
rDSN.Python
provides the interactions between rDSN
and Python scripts. With it, you could call Python functions in rDSN
and vise versa.
for Linux Users
git clone https://github.com/rDSN-Projects/rDSN.Python
cd ./rDSN.Python
build.sh
for Windows Users
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64
git clone https://github.com/rDSN-Projects/rDSN.Python
cd .\rDSN.Python
build.cmd
Chances are that nmake reports “cannot find python27_d.lib”, make a replica of “python27.lib” and change name to “python27_d.lib” to work around it.
what did build.cmd/build.sh
do?
cmake
andmake
to generate dynamic librarydsn.dev.python_helper
- use
virtualenv
to create a virtual and isolated python environment - in
virtualenv
install Python codes ofpython_helper
- in
virtualenv
install Python packages used inrDSN.Monitor
The advantage of virtualenv
is that it packs Python dependencies into one folder so you needn't to install again on the remote machine, and it won't pollute global environment.
Configure and run on single node
Modify config
Add the following lines in the config.ini
of your app:
[apps.monitor]
type = monitor
arguments = 8080
pools = THREAD_POOL_DEFAULT
count = 1
dmodule = dsn.dev.python_helper
dmodule_bridge_arguments = rDSN.monitor\rDSN.Monitor.py
arguments
is the port number http server will use.
dmodule_bridge_arguments
is the path of rDSN.Monitor.py
.
And don't forget to add profiler
to toollets
:
toollets = ..., profiler
Run
Then you could run your program with rDSN.Monitor
enabled!
Turn on virtualenv
and run your program:
for Linux Users
$ . venv/bin/activate
[venv] ./dsn.replication.simple_kv config.ini
for Windows Users
$ venv\Scripts\activate
[venv] .\dsn.replication.simple_kv.exe config.ini
Now you could use rDSN.Monitor
through localhost:8080
.
Configure on a cluster
It's also simple to configure on a cluster!
Modify your config file
Same as above.
Publish apps using run.sh/run.cmd
in rDSN
As usual.
Copy the following extra files to each app folder:
rDSN.monitor
from rDSN.Python/src/apps/venv
from rDSN.Python/
Modify start.sh/start.cmd
:
for Linux Users
Add these lines to start.sh
:
. venv/bin/activate
Export PATH=${PREFIX}/venv/bin:$PATH
These commands activate your python env.
${PREFIX} might be updated to another name later, anyway it’s the main folder's path
Change
.\dsn.replication.simple_kv.exe config.ini -app_list meta@1
to
.\dsn.replication.simple_kv.exe config.ini -app_list meta@1;monitor
for linux, remote machines even don't need to install Python,
virtualenv
sets everything for it
for Windows Users
Add these lines to start.cmd
:
CALL venv\bin\activate.bat
These commands activate your python env.
Change
.\dsn.replication.simple_kv.exe config.ini -app_list meta@1
to
.\dsn.replication.simple_kv.exe config.ini -app_list meta@1;monitor
Modify \venv\Lib\orig-prefix.txt to the python path on the remote machine. For example,
C:\python27
to
D:\python27
for windows now, remote machines need to install Python, that's because
--relocatable
onvirtualenv
is still an experimental function.
Deploy and run
As usual. And for each remote machine, you could view remote-address:8080
for info.
Content