mirror of
https://github.com/bigchaindb/bigchaindb.git
synced 2024-10-13 13:34:05 +00:00
Problem: Signals do not propagate to child BigchainDB processes (#2395).
Solution: Run child processes as daemons to make the signals propagate. Add a short shutdown description to the setup guide.
This commit is contained in:
parent
2386ca9d71
commit
0c33b4c211
@ -1,5 +1,4 @@
|
||||
import logging
|
||||
|
||||
import setproctitle
|
||||
|
||||
import bigchaindb
|
||||
@ -34,14 +33,14 @@ BANNER = """
|
||||
|
||||
def start():
|
||||
# Exchange object for event stream api
|
||||
logger.info('Starting BigchainDB')
|
||||
exchange = Exchange()
|
||||
|
||||
# start the web api
|
||||
app_server = server.create_server(
|
||||
settings=bigchaindb.config['server'],
|
||||
log_config=bigchaindb.config['log'],
|
||||
bigchaindb_factory=BigchainDB)
|
||||
p_webapi = Process(name='bigchaindb_webapi', target=app_server.run)
|
||||
p_webapi = Process(name='bigchaindb_webapi', target=app_server.run, daemon=True)
|
||||
p_webapi.start()
|
||||
|
||||
# start message
|
||||
@ -50,16 +49,18 @@ def start():
|
||||
# start websocket server
|
||||
p_websocket_server = Process(name='bigchaindb_ws',
|
||||
target=websocket_server.start,
|
||||
daemon=True,
|
||||
args=(exchange.get_subscriber_queue(EventTypes.BLOCK_VALID),))
|
||||
p_websocket_server.start()
|
||||
|
||||
# connect to tendermint event stream
|
||||
p_websocket_client = Process(name='bigchaindb_ws_to_tendermint',
|
||||
target=event_stream.start,
|
||||
daemon=True,
|
||||
args=(exchange.get_publisher_queue(),))
|
||||
p_websocket_client.start()
|
||||
|
||||
p_exchange = Process(name='bigchaindb_exchange', target=exchange.run)
|
||||
p_exchange = Process(name='bigchaindb_exchange', target=exchange.run, daemon=True)
|
||||
p_exchange.start()
|
||||
|
||||
# We need to import this after spawning the web server
|
||||
@ -69,6 +70,7 @@ def start():
|
||||
|
||||
setproctitle.setproctitle('bigchaindb')
|
||||
|
||||
# Start the ABCIServer
|
||||
app = ABCIServer(app=App())
|
||||
app.run()
|
||||
|
||||
|
@ -265,6 +265,48 @@ If you want to refresh your node back to a fresh empty state, then your best bet
|
||||
- reset Tendermint using `tendermint unsafe_reset_all`
|
||||
- delete the directory `$HOME/.tendermint`
|
||||
|
||||
## Shutting down BigchainDB
|
||||
|
||||
If you want to stop/kill BigchainDB, you can do so by sending `SIGINT`, `SIGQUIT` or `SIGTERM` to the running BigchainDB
|
||||
process(es). Depending on how you started BigchainDB i.e. foreground or background. e.g. you started BigchainDB in the background as mentioned above in the guide:
|
||||
|
||||
```bash
|
||||
$ nohup bigchaindb start 2>&1 > bigchaindb.log &
|
||||
|
||||
$ # Check the PID of the main BigchainDB process
|
||||
$ ps -ef | grep bigchaindb
|
||||
<user> *<pid> <ppid> <C> <STIME> <tty> <time> bigchaindb
|
||||
<user> <pid> <ppid>* <C> <STIME> <tty> <time> gunicorn: master [bigchaindb_gunicorn]
|
||||
<user> <pid> <ppid>* <C> <STIME> <tty> <time> bigchaindb_ws
|
||||
<user> <pid> <ppid>* <C> <STIME> <tty> <time> bigchaindb_ws_to_tendermint
|
||||
<user> <pid> <ppid>* <C> <STIME> <tty> <time> bigchaindb_exchange
|
||||
<user> <pid> <ppid> <C> <STIME> <tty> <time> gunicorn: worker [bigchaindb_gunicorn]
|
||||
<user> <pid> <ppid> <C> <STIME> <tty> <time> gunicorn: worker [bigchaindb_gunicorn]
|
||||
<user> <pid> <ppid> <C> <STIME> <tty> <time> gunicorn: worker [bigchaindb_gunicorn]
|
||||
<user> <pid> <ppid> <C> <STIME> <tty> <time> gunicorn: worker [bigchaindb_gunicorn]
|
||||
<user> <pid> <ppid> <C> <STIME> <tty> <time> gunicorn: worker [bigchaindb_gunicorn]
|
||||
...
|
||||
|
||||
$ # Send any of the above mentioned signals to the parent/root process(marked with `*` for clarity)
|
||||
# Sending SIGINT
|
||||
$ kill -2 <bigchaindb_parent_pid>
|
||||
|
||||
$ # OR
|
||||
|
||||
# Sending SIGTERM
|
||||
$ kill -15 <bigchaindb_parent_pid>
|
||||
|
||||
$ # OR
|
||||
|
||||
# Sending SIGQUIT
|
||||
$ kill -3 <bigchaindb_parent_pid>
|
||||
|
||||
# If you want to kill all the processes by name yourself
|
||||
$ pgrep bigchaindb | xargs kill -9
|
||||
```
|
||||
|
||||
If you started BigchainDB in the foreground, a `Ctrl + C` or `Ctrl + Z` would shut down BigchainDB.
|
||||
|
||||
## Member: Dynamically Add a New Member to the Network
|
||||
|
||||
TBD.
|
||||
|
Loading…
x
Reference in New Issue
Block a user