1

Since version 0.10.2, Monero has reportedly supported the ability to run two or more instances of monerod with only one copy of the ful blockchain database:

added support for multiple daemons using the same LMDB database

One instance of the daemon I wish to run bound to a public-facing port, for use with e.g., my own personal wallet on a remote machine. A second instance of the daemon I wish to run bound to a non-public-facing port, for use with e.g., my own mining pool on the local machine. I have no issue with either of these cases individually and have confirmed they both work. However, any additional instances of the daemon crash during startup.

One use-case described in the answer to this question is actually very similar to what I attempt to do.

I launch the first instance of monerod with the command:

./monerod --rpc-bind-port <non-public-facing port>

This first instance starts up fine, blockchain syncs successfully, etc. If I alter the arguments to use a public-facing port plus a few other changes (--rpc-bind-ip, --restricted-rpc, --confirm-external-bind) I can successfully connect a remote wallet to the daemon. Everything appears to work correctly when running one instance of the daemon.

I launch the second instance of monerod with the command:

./monerod --rpc-bind-port <different arbitrary unused port>

The output is as follows:

2018-01-07 11:31:08.021            INFO    global  src/daemon/main.cpp:285 Monero 'Helium Hydra' (v0.11.0.0-0e7b29d)
2018-01-07 11:31:08.022            INFO    global  src/daemon/protocol.h:55        Initializing cryptonote protocol...
2018-01-07 11:31:08.022            INFO    global  src/daemon/protocol.h:60        Cryptonote protocol initialized OK
2018-01-07 11:31:08.022            INFO    global  src/daemon/p2p.h:63     Initializing p2p server...
2018-01-07 11:31:08.345            INFO    global  src/daemon/core.h:89    Deinitializing core...
2018-01-07 11:31:08.352            ERROR   daemon  src/daemon/core.h:94    Failed to deinitialize core...
2018-01-07 11:31:08.354            INFO    global  src/daemon/protocol.h:77        Stopping cryptonote protocol...
2018-01-07 11:31:08.356            INFO    global  src/daemon/protocol.h:81        Cryptonote protocol stopped successfully
2018-01-07 11:31:08.358            ERROR   daemon  src/daemon/main.cpp:293 Exception in main! Failed to initialize p2p server.

I then attempt to log additional debug info by appending the argument: --log-file /dev/stdout

The output is as follows:

2018-01-07 11:40:20.767            INFO    logging contrib/epee/src/mlog.cpp:180   New log categories: *:WARNING,net:FATAL,net.p2p:FATAL,net.cn:FATAL,global:INFO,verify:FATAL,stacktrace:INFO,logging:INFO,msgwriter:INFO
2018-01-07 11:40:20.768            INFO    global  src/daemon/main.cpp:285 Monero 'Helium Hydra' (v0.11.0.0-0e7b29d)
2018-01-07 11:40:20.768            INFO    global  src/daemon/main.cpp:285 Monero 'Helium Hydra' (v0.11.0.0-0e7b29d)
2018-01-07 11:40:20.769            INFO    global  src/daemon/protocol.h:55        Initializing cryptonote protocol...
2018-01-07 11:40:20.769            INFO    global  src/daemon/protocol.h:55        Initializing cryptonote protocol...
2018-01-07 11:40:20.769            INFO    global  src/daemon/protocol.h:60        Cryptonote protocol initialized OK
2018-01-07 11:40:20.769            INFO    global  src/daemon/protocol.h:60        Cryptonote protocol initialized OK
2018-01-07 11:40:20.770            INFO    global  src/daemon/p2p.h:63     Initializing p2p server...
2018-01-07 11:40:20.770            INFO    global  src/daemon/p2p.h:63     Initializing p2p server...
2018-01-07 11:40:21.014            INFO    stacktrace      src/common/stack_trace.cpp:120  Exception: boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::system::system_error> >
2018-01-07 11:40:21.015            INFO    stacktrace      src/common/stack_trace.cpp:121  Unwound call stack:
2018-01-07 11:40:21.019            INFO    stacktrace      src/common/stack_trace.cpp:159      [1] ./monerod:__cxa_throw+0x106 [0x80b816]
2018-01-07 11:40:21.019            INFO    stacktrace      src/common/stack_trace.cpp:159      [2] ./monerod:void boost::throw_exception<boost::system::system_error>(boost::system::system_error const&)+0x1d1 [0x56abb1]
2018-01-07 11:40:21.019            INFO    stacktrace      src/common/stack_trace.cpp:159      [3] ./monerod:boost::asio::detail::do_throw_error(boost::system::error_code const&, char const*)+0x55 [0x598cf5]
2018-01-07 11:40:21.019            INFO    stacktrace      src/common/stack_trace.cpp:159      [4] ./monerod:boost::asio::basic_socket_acceptor<boost::asio::ip::tcp, boost::asio::socket_acceptor_service<boost::asio::ip::tcp> >::bind(boost::asio::ip::basic_endpoint<boost::asio::ip::tcp> const&)+0x8d [0x5b7f2d]
2018-01-07 11:40:21.019            INFO    stacktrace      src/common/stack_trace.cpp:159      [5] ./monerod:epee::net_utils::boosted_tcp_server<epee::levin::async_protocol_handler<nodetool::p2p_connection_context_t<cryptonote::cryptonote_connection_context> > >::init_server(unsigned int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)+0x35c [0x682a3c]
2018-01-07 11:40:21.019            INFO    stacktrace      src/common/stack_trace.cpp:159      [6] ./monerod:epee::net_utils::boosted_tcp_server<epee::levin::async_protocol_handler<nodetool::p2p_connection_context_t<cryptonote::cryptonote_connection_context> > >::init_server(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)+0x71 [0x6833f1]
2018-01-07 11:40:21.019            INFO    stacktrace      src/common/stack_trace.cpp:159      [7] ./monerod:nodetool::node_server<cryptonote::t_cryptonote_protocol_handler<cryptonote::core> >::init(boost::program_options::variables_map const&)+0x17dc [0x684e4c]
2018-01-07 11:40:21.019            INFO    stacktrace      src/common/stack_trace.cpp:159      [8] ./monerod:daemonize::t_p2p::t_p2p(boost::program_options::variables_map const&, daemonize::t_protocol&)+0x4d9 [0x685df9]
2018-01-07 11:40:21.019            INFO    stacktrace      src/common/stack_trace.cpp:159      [9] ./monerod:daemonize::t_internals::t_internals(boost::program_options::variables_map const&)+0x553 [0x6866d3]
2018-01-07 11:40:21.019            INFO    stacktrace      src/common/stack_trace.cpp:159      [10] ./monerod:daemonize::t_daemon::t_daemon(boost::program_options::variables_map const&)+0x38 [0x5853e8]
2018-01-07 11:40:21.019            INFO    stacktrace      src/common/stack_trace.cpp:159      [11] ./monerod:daemonize::t_executor::run_interactive(boost::program_options::variables_map const&)+0x1d [0x6995bd]
2018-01-07 11:40:21.019            INFO    stacktrace      src/common/stack_trace.cpp:159      [12] ./monerod:bool daemonizer::daemonize<daemonize::t_executor>(int, char const**, daemonize::t_executor&&, boost::program_options::variables_map const&)+0x184 [0x69c374]
2018-01-07 11:40:21.019            INFO    stacktrace      src/common/stack_trace.cpp:159      [13] ./monerod:main+0x148f [0x55818f]
2018-01-07 11:40:21.019            INFO    stacktrace      src/common/stack_trace.cpp:159      [14] /lib/x86_64-linux-gnu/libc.so.6:__libc_start_main+0xf0 [0x7f013424e830]
2018-01-07 11:40:21.019            INFO    stacktrace      src/common/stack_trace.cpp:159      [15] ./monerod:_start+0x29 [0x560459]
2018-01-07 11:40:21.019            INFO    stacktrace      src/common/stack_trace.cpp:159
2018-01-07 11:40:21.019            INFO    stacktrace      src/common/stack_trace.cpp:120  Exception: std::runtime_error
2018-01-07 11:40:21.020            INFO    stacktrace      src/common/stack_trace.cpp:121  Unwound call stack:
2018-01-07 11:40:21.022            INFO    stacktrace      src/common/stack_trace.cpp:159      [1] ./monerod:__cxa_throw+0x106 [0x80b816]
2018-01-07 11:40:21.022            INFO    stacktrace      src/common/stack_trace.cpp:159      [2] ./monerod:daemonize::t_p2p::t_p2p(boost::program_options::variables_map const&, daemonize::t_protocol&)+0x655 [0x685f75]
2018-01-07 11:40:21.022            INFO    stacktrace      src/common/stack_trace.cpp:159      [3] ./monerod:daemonize::t_internals::t_internals(boost::program_options::variables_map const&)+0x553 [0x6866d3]
2018-01-07 11:40:21.022            INFO    stacktrace      src/common/stack_trace.cpp:159      [4] ./monerod:daemonize::t_daemon::t_daemon(boost::program_options::variables_map const&)+0x38 [0x5853e8]
2018-01-07 11:40:21.022            INFO    stacktrace      src/common/stack_trace.cpp:159      [5] ./monerod:daemonize::t_executor::run_interactive(boost::program_options::variables_map const&)+0x1d [0x6995bd]
2018-01-07 11:40:21.022            INFO    stacktrace      src/common/stack_trace.cpp:159      [6] ./monerod:bool daemonizer::daemonize<daemonize::t_executor>(int, char const**, daemonize::t_executor&&, boost::program_options::variables_map const&)+0x184 [0x69c374]
2018-01-07 11:40:21.023            INFO    stacktrace      src/common/stack_trace.cpp:159      [7] ./monerod:main+0x148f [0x55818f]
2018-01-07 11:40:21.023            INFO    stacktrace      src/common/stack_trace.cpp:159      [8] /lib/x86_64-linux-gnu/libc.so.6:__libc_start_main+0xf0 [0x7f013424e830]
2018-01-07 11:40:21.023            INFO    stacktrace      src/common/stack_trace.cpp:159      [9] ./monerod:_start+0x29 [0x560459]
2018-01-07 11:40:21.023            INFO    stacktrace      src/common/stack_trace.cpp:159
2018-01-07 11:40:21.025            INFO    global  src/daemon/core.h:89    Deinitializing core...
2018-01-07 11:40:21.025            INFO    global  src/daemon/core.h:89    Deinitializing core...
2018-01-07 11:40:21.025            INFO    stacktrace      src/common/stack_trace.cpp:120  Exception: cryptonote::DB_ERROR*
2018-01-07 11:40:21.026            INFO    stacktrace      src/common/stack_trace.cpp:121  Unwound call stack:
2018-01-07 11:40:21.028            INFO    stacktrace      src/common/stack_trace.cpp:159      [1] ./monerod:__cxa_throw+0x106 [0x80b816]
2018-01-07 11:40:21.029            INFO    stacktrace      src/common/stack_trace.cpp:159      [2] ./monerod:cryptonote::Blockchain::deinit()+0xc48 [0x773508]
2018-01-07 11:40:21.029            INFO    stacktrace      src/common/stack_trace.cpp:159      [3] ./monerod:cryptonote::core::deinit()+0x25 [0x79e2f5]
2018-01-07 11:40:21.029            INFO    stacktrace      src/common/stack_trace.cpp:159      [4] ./monerod:daemonize::t_core::~t_core()+0xcb [0x5a47eb]
2018-01-07 11:40:21.029            INFO    stacktrace      src/common/stack_trace.cpp:159      [5] ./monerod:daemonize::t_internals::t_internals(boost::program_options::variables_map const&)+0x9ef [0x686b6f]
2018-01-07 11:40:21.029            INFO    stacktrace      src/common/stack_trace.cpp:159      [6] ./monerod:daemonize::t_daemon::t_daemon(boost::program_options::variables_map const&)+0x38 [0x5853e8]
2018-01-07 11:40:21.029            INFO    stacktrace      src/common/stack_trace.cpp:159      [7] ./monerod:daemonize::t_executor::run_interactive(boost::program_options::variables_map const&)+0x1d [0x6995bd]
2018-01-07 11:40:21.029            INFO    stacktrace      src/common/stack_trace.cpp:159      [8] ./monerod:bool daemonizer::daemonize<daemonize::t_executor>(int, char const**, daemonize::t_executor&&, boost::program_options::variables_map const&)+0x184 [0x69c374]
2018-01-07 11:40:21.029            INFO    stacktrace      src/common/stack_trace.cpp:159      [9] ./monerod:main+0x148f [0x55818f]
2018-01-07 11:40:21.029            INFO    stacktrace      src/common/stack_trace.cpp:159      [10] /lib/x86_64-linux-gnu/libc.so.6:__libc_start_main+0xf0 [0x7f013424e830]
2018-01-07 11:40:21.029            INFO    stacktrace      src/common/stack_trace.cpp:159      [11] ./monerod:_start+0x29 [0x560459]
2018-01-07 11:40:21.029            INFO    stacktrace      src/common/stack_trace.cpp:159
2018-01-07 11:40:21.029            ERROR   daemon  src/daemon/core.h:94    Failed to deinitialize core...
2018-01-07 11:40:21.029            ERROR   daemon  src/daemon/core.h:94    Failed to deinitialize core...
2018-01-07 11:40:21.029            INFO    global  src/daemon/protocol.h:77        Stopping cryptonote protocol...
2018-01-07 11:40:21.029            INFO    global  src/daemon/protocol.h:77        Stopping cryptonote protocol...
2018-01-07 11:40:21.029            INFO    global  src/daemon/protocol.h:81        Cryptonote protocol stopped successfully
2018-01-07 11:40:21.029            INFO    global  src/daemon/protocol.h:81        Cryptonote protocol stopped successfully
2018-01-07 11:40:21.030            ERROR   daemon  src/daemon/main.cpp:293 Exception in main! Failed to initialize p2p server.
2018-01-07 11:40:21.030            ERROR   daemon  src/daemon/main.cpp:293 Exception in main! Failed to initialize p2p server.

Am I doing anything identifiably wrong on my end or perhaps overlooking something?

Also, I am running Ubuntu 16.04.3 LTS, if anybody is curious.

1

A few things to try:

  1. Run each daemon under a different user but pointing to the same blockchain location

--data-dir /path/to/.bitmonero

  1. --rpc-bind-port [PORT] is for port used for remote procedure call connections such as from wallets to connect with the daemon but when changing the port that monerod uses to connect with other nodes on the network use

--p2p-bind-port [PORT]

  1. Remember to use restrict your public rpc with

--restricted-rpc

1

Your daemon is failing to bind to the default P2P port (18080), and it would also fail to bind to the 0MQ RPC port (18082) since you didn't tell it to use other ones. You need to to use --p2p-bind-port XXX --zmq-rpc-bind-port ZZZ, with XXX and ZZZ being non priviledged ports on which no other process is bound.

The binding error is not displayed by default in the last tagged version, but is in current master. Using --log-level 1 would show it.

Finally, your original goal can also be achieved with a single daemon, using the (recent) --rpc-restricted-bind-port YYY option (again, needs a free port).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.