In the previous post I mentioned that Apache Pulsar does not come with systemd unit files. So, below is a copy. If I remember right I got them somewhere on the Internet, unfortunately I do not remember where. I think I added a thing or two. If you, the reader, happen to be the original author, feel free to ping me to give credit where it’s due.

Bookie:

[Unit]
Description=Pulsar BookKeeper
After=network.target

[Service]
ExecStart=/opt/pulsar/bin/pulsar bookie
WorkingDirectory=/opt/pulsar
User=pulsar
Group=pulsar
RestartSec=10s
Restart=on-failure
Type=simple

[Install]
WantedBy=multi-user.target

Broker:

[Unit]
Description=Pulsar Broker
After=network.target

[Service]
ExecStart=/opt/pulsar/bin/pulsar broker
WorkingDirectory=/opt/pulsar
User=pulsar
Group=pulsar
RestartSec=10s
Restart=on-failure
Type=simple

[Install]
WantedBy=multi-user.target

Zookeeper:

[Unit]
Description=Pulsar ZooKeeper
After=network.target

[Service]
Environment=OPTS=-Dstats_server_port=2182
ExecStart=/opt/pulsar/bin/pulsar zookeeper
WorkingDirectory=/opt/pulsar
User=pulsar
Group=pulsar
RestartSec=10s
Restart=on-failure
Type=simple

[Install]
WantedBy=multi-user.target