Answers: <p>I found my fault.
  It's necessary define a <code>cassandra.service</code> to Systemd manages Cassandra:</p>
  <p><em>path</em>: <code>/etc/systemd/system/cassandra.service</code></p>
  <p>And adjust like you installation</p>
  <pre><code>[Unit]
  Description=Cassandra Cluster Node Daemon
  
  [Service]
  Type=forking
  User=cassandra
  ExecStartPre=/usr/bin/echo &quot;Starting Cassandra Daemon&quot;
  ExecStart=/usr/sbin/cassandra
  ExecStartPost=/usr/bin/echo &quot;Cassandra Daemon Running&quot;
  
  ExecStopPost=/usr/bin/rm -rf /cassandra/saved_caches;/usr/bin/echo &quot;Cassandra Daemon Stopped&quot;
  
  SuccessExitStatus=143
  
  [Install]
  WantedBy=default.target
  </code></pre>
  
Answers: CC BY-SA 4.0
Answers: 2021-04-06T14:32:10.300Z
Answers: 2021-04-06T14:32:10.300Z
Answers: Vader
Body: <p>I have been tried ran a Ansible Playboo, but after change the <code>cassandra.yml</code> when the service tries start I received this error bellow:</p>
  <pre><code>● cassandra.service - LSB: distributed storage system for structured data
     Loaded: loaded (/etc/rc.d/init.d/cassandra; bad; vendor preset: disabled)
     Active: failed (Result: exit-code) since sex 2021-04-02 01:06:05 UTC; 15min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 5052 ExecStop=/etc/rc.d/init.d/cassandra stop (code=exited, status=1/FAILURE)
    Process: 4883 ExecStart=/etc/rc.d/init.d/cassandra start (code=exited, status=0/SUCCESS)
   Main PID: 4972 (code=exited, status=3)
  
  abr 02 01:05:37 ip-10-5-10-195.ec2.internal cassandra[4883]: Starting Cassandra: OK
  abr 02 01:05:37 ip-10-5-10-195.ec2.internal systemd[1]: Started LSB: distributed storage system for structured data.
  abr 02 01:05:40 ip-10-5-10-195.ec2.internal systemd[1]: cassandra.service: main process exited, code=exited, status=3/NOTIMPLEMENTED
  abr 02 01:05:40 ip-10-5-10-195.ec2.internal runuser[5063]: pam_unix(runuser:session): session opened for user cassandra by (uid=0)
  abr 02 01:05:40 ip-10-5-10-195.ec2.internal cassandra[5052]: Shutdown Cassandra: kill: sending signal to 4972 failed: No such process
  abr 02 01:05:40 ip-10-5-10-195.ec2.internal runuser[5063]: pam_unix(runuser:session): session closed for user cassandra
  abr 02 01:06:05 ip-10-5-10-195.ec2.internal cassandra[5052]: ERROR: could not stop cassandra
  abr 02 01:06:05 ip-10-5-10-195.ec2.internal systemd[1]: cassandra.service: control process exited, code=exited status=1
  abr 02 01:06:05 ip-10-5-10-195.ec2.internal systemd[1]: Unit cassandra.service entered failed state.
  abr 02 01:06:05 ip-10-5-10-195.ec2.internal systemd[1]: cassandra.service failed.
  </code></pre>
  <p>In my <em>cassandra.yml</em> I just change the mount point/path where Cassandra stores the <strong>data</strong> and sure that this works.</p>
  <p>Looking at Cassandra <code>system.log</code> I found:</p>
  <pre><code>ERROR [main] 2021-04-05 16:57:34,074 CassandraDaemon.java:822 - Exception encountered during startup
  java.lang.ExceptionInInitializerError: null
      at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:240)
      at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:676)
      at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:800)
  Caused by: java.lang.IllegalStateException: Failed to mkdirs /hints; unable to start server
      at org.apache.cassandra.config.DatabaseDescriptor.createAllDirectories(DatabaseDescriptor.java:1395)
      at org.apache.cassandra.db.commitlog.CommitLog.&lt;init&gt;(CommitLog.java:95)
      at org.apache.cassandra.db.commitlog.CommitLog.construct(CommitLog.java:78)
      at org.apache.cassandra.db.commitlog.CommitLog.&lt;clinit&gt;(CommitLog.java:65)
      ... 3 common frames omitted
  </code></pre>
  <p>It's weird because I create the directory at new mount point with <code>cassandra:cassandra</code> permitions:</p>
  <pre><code>drwxr-xr-x  2 cassandra cassandra   6 abr  5 14:46 commitlog
  drwxr-xr-x  2 cassandra cassandra   6 abr  5 14:46 data
  drwxr-xr-x  2 cassandra cassandra   6 abr  5 16:53 hints
  drwxr-xr-x  2 cassandra cassandra   6 abr  5 16:53 saved_caches
  </code></pre>
  <p>I have been spend long hours trying solve but without success, someone my can help me?</p>
  
Tags: <ansible><cassandra><systemd>
Title: Ansible Playbook fails start Apache Cassandra
UserDisplayName: Vader
ThreadText: # Ansible Playbook fails start Apache Cassandra
  
  (Asked by: username_0 on 2021-04-02)
  
  I have been tried ran a Ansible Playboo, but after change the `cassandra.yml` when the service tries start I received this error bellow:
  
  ```
  ● cassandra.service - LSB: distributed storage system for structured data
     Loaded: loaded (/etc/rc.d/init.d/cassandra; bad; vendor preset: disabled)
     Active: failed (Result: exit-code) since sex 2021-04-02 01:06:05 UTC; 15min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 5052 ExecStop=/etc/rc.d/init.d/cassandra stop (code=exited, status=1/FAILURE)
    Process: 4883 ExecStart=/etc/rc.d/init.d/cassandra start (code=exited, status=0/SUCCESS)
   Main PID: 4972 (code=exited, status=3)
  
  abr 02 01:05:37 ip-10-5-10-195.ec2.internal cassandra[4883]: Starting Cassandra: OK
  abr 02 01:05:37 ip-10-5-10-195.ec2.internal systemd[1]: Started LSB: distributed storage system for structured data.
  abr 02 01:05:40 ip-10-5-10-195.ec2.internal systemd[1]: cassandra.service: main process exited, code=exited, status=3/NOTIMPLEMENTED
  abr 02 01:05:40 ip-10-5-10-195.ec2.internal runuser[5063]: pam_unix(runuser:session): session opened for user cassandra by (uid=0)
  abr 02 01:05:40 ip-10-5-10-195.ec2.internal cassandra[5052]: Shutdown Cassandra: kill: sending signal to 4972 failed: No such process
  abr 02 01:05:40 ip-10-5-10-195.ec2.internal runuser[5063]: pam_unix(runuser:session): session closed for user cassandra
  abr 02 01:06:05 ip-10-5-10-195.ec2.internal cassandra[5052]: ERROR: could not stop cassandra
  abr 02 01:06:05 ip-10-5-10-195.ec2.internal systemd[1]: cassandra.service: control process exited, code=exited status=1
  abr 02 01:06:05 ip-10-5-10-195.ec2.internal systemd[1]: Unit cassandra.service entered failed state.
  abr 02 01:06:05 ip-10-5-10-195.ec2.internal systemd[1]: cassandra.service failed.
  
  ```
  
  In my *cassandra.yml* I just change the mount point/path where Cassandra stores the **data** and sure that this works.
  
  Looking at Cassandra `system.log` I found:
  
  ```
  ERROR [main] 2021-04-05 16:57:34,074 CassandraDaemon.java:822 - Exception encountered during startup
  java.lang.ExceptionInInitializerError: null
      at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:240)
      at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:676)
      at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:800)
  Caused by: java.lang.IllegalStateException: Failed to mkdirs /hints; unable to start server
      at org.apache.cassandra.config.DatabaseDescriptor.createAllDirectories(DatabaseDescriptor.java:1395)
      at org.apache.cassandra.db.commitlog.CommitLog.<init>(CommitLog.java:95)
      at org.apache.cassandra.db.commitlog.CommitLog.construct(CommitLog.java:78)
      at org.apache.cassandra.db.commitlog.CommitLog.<clinit>(CommitLog.java:65)
      ... 3 common frames omitted
  
  ```
  
  It's weird because I create the directory at new mount point with `cassandra:cassandra` permitions:
  
  ```
  drwxr-xr-x  2 cassandra cassandra   6 abr  5 14:46 commitlog
  drwxr-xr-x  2 cassandra cassandra   6 abr  5 14:46 data
  drwxr-xr-x  2 cassandra cassandra   6 abr  5 16:53 hints
  drwxr-xr-x  2 cassandra cassandra   6 abr  5 16:53 saved_caches
  
  ```
  
  I have been spend long hours trying solve but without success, someone my can help me?
  
  **Tags:** ansible, cassandra, systemd
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2021-04-06. Score: 1 | Accepted answer
  
  I found my fault.
  It's necessary define a `cassandra.service` to Systemd manages Cassandra:
  
  *path*: `/etc/systemd/system/cassandra.service`
  
  And adjust like you installation
  
  ```
  [Unit]
  Description=Cassandra Cluster Node Daemon
  
  [Service]
  Type=forking
  User=cassandra
  ExecStartPre=/usr/bin/echo "Starting Cassandra Daemon"
  ExecStart=/usr/sbin/cassandra
  ExecStartPost=/usr/bin/echo "Cassandra Daemon Running"
  
  ExecStopPost=/usr/bin/rm -rf /cassandra/saved_caches;/usr/bin/echo "Cassandra Daemon Stopped"
  
  SuccessExitStatus=143
  
  [Install]
  WantedBy=default.target
  
  ```
  
  
  ---
  
  