How to start Cassandra as service in Windows 10/7/server

We already did a tutorial article in which we had explained the way to install Apache Cassandra on Windows 10 or Windows Server 2008/2012 but without datastax. But there was a problem after running the Apache Cassandra service on Command prompt you can’t close it otherwise you won’t be able to use Cassandra commands for Database. However, running on PowerShell, indeed, we can close it and Cassandra service will still be running in the background, but there is one catch that is after restarting the computer you again have to start service to get Apache Cassandra up and running. This is a little bit annoying for regular users of this NoSQL database. So, here is the way to run the Apache Cassandra as background Windows service which automatically starts with computer boot up.

Run or Start Cassandra as Windows 10/7 or Server service

Before following the below steps the Cassandra must be installed on your computer if it not then here is tutorial on that: Install Apache Cassandra on windows 10/8/7 without Datastax

Step 1: Download Apache commons daemon

To run Cassandra as a Windows service, the first thing we need is the open source project Apache commons daemon that provides a portable way to start and stop a Java Virtual Machine that is running server-side applications.

Here is the link to download Apache commons daemon library. Select the latest update zip file and download that.

apache common daemon

Step 2: Extract Apache commons daemon

After downloading the Apache commons daemon zipped file, extract it and move to the next step.


 

Step 3: Cassandra Bin folder

Go to your Cassandra folder that you have downloaded and set up to run its different services. Inside the Cassandra folder there in one another folder named “Bin” open that.

Step 4: Create a Daemon folder

Inside the bin folder of Cassandra create a folder named daemon, manually. As shown in the below screenshot.

Start Cassandra as Windows 10 or Server service 

Step 5: Copy prunsrv.exe

Now get back to your Apache common Daemon extracted the folder and as per your operating system 32 bit or 64-bit copy prunsrv.exe file. The 64-bit version file is inside the amd64 folder.

Copy prunsrv

After copying it again go to the daemon folder you have created inside the bin folder of Cassandra and paste prunsrv.exe there.

Step 6: Install Cassandra as a Windows service

Open the Command prompt as administrator and navigate to Cassandra->bin folder and execute the following command:

cassandra.bat -install

Install Cassandra as a Windows service

This makes Cassandra service automatically starts on Windows 10/8/7 or Windows servers.

Step 7: How to start or stop Cassandra service in windows

We have added the Casandra in Windows service, thus, you can easily get it in the Services app of windows. To open that type services in the Windows search box and open it, as it appears.

run services app

Find the Cassandra service and from there you can start or stop Apache Cassandra service on Windows platform with one click.

Running Cassandra as a Windows Service

Other Useful Resources:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.