basho / riak

Riak is a decentralized datastore from Basho Technologies.
http://docs.basho.com
Apache License 2.0
3.92k stars 534 forks source link

Riak Top missing from KV 3.0.1 #1048

Closed Bob-The-Marauder closed 3 years ago

Bob-The-Marauder commented 3 years ago

Expected behaviour (from KV 2.9.8):

root@TIOT-RP4-001:~/riak# riak top
=======
 'riak@127.0.0.1'                                                          15:44:04
 Load:  cpu        20               Memory:  total       60305    binary        628
        procs    1967                        processes   30773    code         7942
        runq        0                        atom          515    ets          3983

Pid                 Name or Initial Func         Time       Reds     Memory       MsgQ Current Function
-------------------------------------------------------------------------------------------------------------------------------
<7421.3.0>          erl_prim_loader               '-'    1339238     115184          0 erl_prim_loader:loop/3           
<7421.0.0>          init                          '-'     160951       4392          0 init:loop/1                      
<7421.25.0>         file_server_2                 '-'     142719       2924          0 gen_server:loop/6                
<7421.26.0>         code_server                   '-'     132332     115224          0 code_server:loop/1               
<7421.187.0>        riak_core_ring_manager        '-'      76615      27552          0 gen_server:loop/6                
<7421.6.0>          error_logger                  '-'      67538       2944          0 gen_event:fetch_msg/5            
<7421.52.0>         lager_event                   '-'      53888      10908          0 gen_event:fetch_msg/5            
<7421.7.0>          application_controller        '-'      42686      28112          0 gen_server:loop/6                
<7421.1461.0>       riak_core_vnode:init/1        '-'      40280      17384          0 gen_fsm:loop/7                   
<7421.1440.0>       riak_core_vnode:init/1        '-'      40272      17384          0 gen_fsm:loop/7     

OR

root@TIOT-RP4-001:~/riak# riak-admin top
=======
 'riak@127.0.0.1'                                                          15:45:34
 Load:  cpu         0               Memory:  total       60954    binary        646
        procs    1968                        processes   30965    code         8169
        runq        0                        atom          519    ets          3994

Pid                 Name or Initial Func         Time       Reds     Memory       MsgQ Current Function
-------------------------------------------------------------------------------------------------------------------------------
<6673.3.0>          erl_prim_loader               '-'    4883432     115184          0 erl_prim_loader:loop/3           
<6673.169.0>        application_master:start_     '-'    2073932    2059776          0 application_master:loop_it/4     
<6673.26.0>         code_server                   '-'    1095173     115224          0 code_server:loop/1               
<6673.386.0>        riak_kv_entropy_manager       '-'     307874      73948          0 gen_server:loop/6                
<6673.187.0>        riak_core_ring_manager        '-'     276717      71388          0 gen_server:loop/6                
<6673.0.0>          init                          '-'     233652       4392          0 init:loop/1                      
<6673.205.0>        riak_core_vnode_manager       '-'     179439      49416          0 gen_server:loop/6                
<6673.25.0>         file_server_2                 '-'     178716       4432          0 gen_server:loop/6                
<6673.6.0>          error_logger                  '-'     164055       2944          0 gen_event:fetch_msg/5            
<6673.206.0>        riak_core_capability          '-'     146776      17204          0 gen_server:loop/6

Actual behaviour from KV 3.0.1:

root@TIOT-RP4-001:~/riak# riak top
Usage: riak {start|start_boot <file>|foreground|stop|restart|reboot|pid|ping|console|console_clean|console_boot <file>|attach|remote_console|upgrade|downgrade|install|uninstall|versions|escript|rpc|rpcterms|eval|status|admin|debug|repl|chkconfig}

OR

root@TIOT-RP4-001:~/riak# riak admin top
/usr/lib/riak/bin/riak: 996: /usr/lib/riak/bin/riak-admin: /erl: not found
martinsumner commented 3 years ago

The riak-admin script doesn't appear to know about $ERTS_PATH (so this will impact other riak-admin commands like reip, backup and restore).

However, even after setting this I can't get it to work - it gets a connection error trying to connect to the Erlang VM.

More investigation required. @martincox any ideas?

martinsumner commented 3 years ago

One of the problems is resolved by adding observer to the list of applications. This doesn't resolve the path issue, but now etop will run (e.g. from remote_console)

martinsumner commented 3 years ago

The relx script uses $BINDIR as the ERTS_PATH, and export this - so the path issue is resolvable I think by adding

ERTS_PATH=$BINDIR

to the top of the riak-admin script.

martinsumner commented 3 years ago

Now fails with:

init terminating in do_boot ({cannot get bootfile,[PATH]/riak/rel/riak/bin/start.boot})

What is looking for start.boot (and not start_clean.boot which is there)?

using the -boot switch on the erl command gets passed this - but still it fails:

Error Couldn't connect to node 'riak@127.0.0.1' 

This is the right node name (as we're just running riak locally after make rel). The bookie is being set. There is an issue with the naming of the hidden node (as $NAME_PARAM is not set to "-name" in the riak-admin script), but the error persists after resolving this.

martinsumner commented 3 years ago

I re-did these changes, and everything now appears to work. The connection error has not re-occurred in OTP20, OTP21 or OTP22.

https://github.com/basho/riak/pull/1049

@Bob-The-Marauder - can you review and test this PR please?

Bob-The-Marauder commented 3 years ago

Tested and working. Thank you