github.com/muhammedhassanm/blockchain@v0.0.0-20200120143007-697261defd4d/sawtooth-core-master/docs/source/sysadmin_guide/systemd.rst (about)

     1  *****************************
     2  Running Sawtooth as a Service
     3  *****************************
     4  
     5  When installing Sawtooth using apt-get, *systemd* units are added for the
     6  following components. These can then be started, stopped, and restarted using
     7  the *systemctl* command:
     8  
     9  * validator
    10  * transaction processors
    11  * rest_api
    12  
    13  To learn more about *systemd* and the *systemctl* command, check out `this
    14  guide`_:
    15  
    16  .. _this guide: https://www.digitalocean.com/community/tutorials/how-to-use-systemctl-to-manage-systemd-services-and-units
    17  
    18  
    19  Viewing Console Output
    20  ----------------------
    21  
    22  To view the console output that you would see if you ran the components
    23  manually, run the following command:
    24  
    25  .. code-block:: console
    26  
    27    $ sudo journalctl -f \
    28        -u sawtooth-validator \
    29        -u sawtooth-settings-tp \
    30        -u sawtooth-poet-validator-registry-tp \
    31        -u sawtooth-rest-api
    32  
    33  Validator Start-up Process
    34  ==========================
    35  
    36  Create Genesis Block
    37  --------------------
    38  
    39  The first validator created in a new network must load a genesis block on
    40  creation to enable other validators to join the network. Prior to starting the
    41  first validator, run the following commands to generate a genesis block that
    42  the first validator can load:
    43  
    44  .. code-block:: console
    45  
    46    $ sawtooth keygen --key-dir ~/sawtooth
    47    $ sawset genesis --key ~/sawtooth.priv
    48    $ sawadm genesis config-genesis.batch
    49  
    50  Running Sawtooth
    51  ----------------
    52  
    53  .. note::
    54    Before starting the ``validator`` component you may need to generate
    55    the validator keypairs using the following command:
    56  
    57    .. code-block:: console
    58  
    59      $ sudo sawadm keygen
    60  
    61  
    62  To start a component using *systemd*, run the following command where
    63  `COMPONENT` is one of:
    64  
    65    * validator
    66    * rest-api
    67    * intkey-tp-python
    68    * settings-tp
    69    * xo-tp-python
    70  
    71  .. code-block:: console
    72  
    73    $ sudo systemctl start sawtooth-COMPONENT
    74  
    75  To see the status of a component run:
    76  
    77  .. code-block:: console
    78  
    79    $ sudo systemctl status sawtooth-COMPONENT
    80  
    81  Likewise, to stop a component run:
    82  
    83  .. code-block:: console
    84  
    85    $ sudo systemctl stop sawtooth-COMPONENT
    86  
    87  .. Licensed under Creative Commons Attribution 4.0 International License
    88  .. https://creativecommons.org/licenses/by/4.0/