Installing Apache Cassandra on Windows in 2021

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello ladies and gentlemen i just wanted to record a quick updated video on how to set up apache cassandra on windows 10. and uh this is because some of the things have changed since my last version of the video there's a few more hurdles that i've had to go through in order to get it to run correctly so i thought i would pass that along with a new setup video but you can see here i've got a fresh install of windows there's nothing particularly set up here the only thing i've done is i've downloaded the files already but i'm going to show you where to go to download those as well so this is apache cassandra's website you can go to cassandra apache.org and here what we're going to do is first check out the documentation now this is before version 4 has been released so i'm going to go ahead and click on the right here um or actually zoom out just a little bit and uh click on the documentation here and this is uh so the release candidate of version 4 is out this version doesn't have the powershell commands to run on windows so you can't quite use that yet but if version 4 is out you might want to try that instead of version 3. but we're going to check out the version 3 documentation currently so version 4 will be better it uses a newer version of java and it also works with python 3 instead of python 2 but for now we're kind of stuck with the with the old version of java and python so here's the documentation i just changed the number here to 3.11.11 and i'm going to click on getting started and then clicking on install cassandra and you can see here it's requiring uh either the oracle's java 8 or the openjd key k8 version and you can check that with java.version and also python 2.7 if you need the command line query language shell and so that's the command cassandra query language shell is what that stands for and so if you don't need that on this computer that you're running then you can probably switch just use python 3. but i'm going to use python 2 so that we can use that on the same computer and you can see if i open up the command prompt i'm going to go down here to windows system and command prompt or you can just search for command prompt right now if i type in java version it's not recognized also if i type in python version that command also returns nothing because i don't have a version of python set up yet so we're going to go ahead and get those set up so if you go to the python website python.org you can click download and you might be tempted to click on this but no that's version three so we can't do that yet so click on windows here and then scroll down and click on the latest version of python 2 and then because i'm using the 64-bit version of windows i'm going to download this version here the windows x864 msi installer and if you click on that that will download i've already downloaded it and you can check your version of windows to see if it's 64-bit um or if you need this version the x86 version by in the search here you can type in about about your pc and you can see here system type uh 64-bit operating system um so after you've downloaded python uh then you can uh either download oracle's java development kit uh or do the adopt open java development kit what i like about open java develop kit other than it being open source is you also don't need to create an account um with oracle so oracle requires you to create an account in order to download the file which you can do it's free and there's no problem there but this is a little easier so i'm going to click on open jdk 8 and then click on either of these but i'm going to choose hotspot either one should work and then click latest release just click that and it should download and then another thing we can do is to go ahead and download cassandra so under cassandra's website i'm going to click downloads here and we'll click on the latest stable release again as the timer recording it's a cassandra 3 not cassandra 4 because that's still a release candidate so i'm going to click on 3.11.10 and then i'm going to click on this link here to download it notice that this is a tar gun zip and so what that means is it's a compressed file that we can't by default extract with windows built-in tools so after downloading that we'll need something like 7zip 7zip is a great option and so if you go to 7zip.org you can click download here for the 64-bit version if you have that version of windows otherwise you can use the 32-bit version here so click on that and download that now i've got all those files already installed or already downloaded in my downloads folder so here's my downloads folder and we can just go ahead and install each of them so i'm going to first install python and i'll do install it for all users and i'll keep the default path and here one thing that's helpful to check is add python.exe to path so i'm going to install that as well we can change that later but it's helpful to do it here it's a little easier i'll show you how to do both ways this installation doesn't take too long we'll let that go ahead and finish real quick okay and so that's finished so we'll press finish and then we'll go ahead and install the open jdk or the other version of the java development kit if you got it from orgle and i'm going to accept the agreement here and then again here we want to make sure that add to path is selected also we want to set this java home variable we can again do this later but it's easier to just let the installer do it for us click install and then finished and now uh what we can do is double check that those environment variables are set up or if you haven't uh didn't check the box or had these previously installed you can do it here so in the search box here i'm going to type in environment and you can see it's popping up already with edit system environment variables so i'm going to click on that it's an easy way to do it and then click on environment variables here at the bottom and there's two sets uh one is the user variables these are just for your logged in user uh just you not other users on this computer and system variables apply to all users so we can see that there's a java home added for all users and that's good if not we could click new and add it and then here on path i'm going to double click on the path here you can see here's a link to the bin folder inside our java development kit inside the path variable and also we've got these two python paths here as well added already if they're not here you can click new and then click browse and browse to those locations on your computer so for example we know we installed python on the c drive and there it is so we could click on this and add it obviously i don't need to do that because those are already set okay so next is to extract cassandra so here it is and again we need some kind of tool to extract that so i'm going to go ahead and install 7-zip really quickly this installs very quickly and then we have we can right click on our thing here and click 7-zip the new thing and i'm just going to click extract here that'll extract just the tar file which is also needs to be extracted so we'll right-click on this tar file and click 7-zip and you can just extract it here if you want to what i'm going to do is go ahead and move it to the c drive so i'm going to click extract files and then i'm going to change this path here to be c colon slash i like to put cassandra right in the root of my path you could put it elsewhere but it's a good idea to put in a path that doesn't have spaces in it and then i'm going to uncheck this here um it doesn't need to create this location here to put it the tar file already has a folder inside of it i'm going to hit ok and this is going to extract really quickly into the c drive now we can click on this pc and go to the c drive and you see there's a folder here for apache cassandra if i click on that it has a bin folder and a config folder the bin is where you'll run your commands and config configures how it's set up so what we're going to do now is we're going to just try it it probably won't work but we can make some changes and just see what happens so i'm going to open up the command prompt again and go ahead and maximize it and uh we'll change directories into c slash um apache cassandra slash bin and so once we're in there we're going to type cassandra and just see what happens uh see see if it is able to run successfully we'll probably still have to make a few changes we'll see a warning and it notice it it exited so if it exits uh then it's not working it should remain running here in the command line so we shouldn't get another prompt here and there's some errors that we can fix uh now one thing uh at the very top here um is this warning powershell um execution unavailable so if you see this same error we'll want to run this command um so we'll want to set up the powershell so what we'll want to make it unrestricted to have it build to run enhanced mode so i'm going to right click on the windows thing here uh the windows button and click windows powershell admin and accept that and then here what you can do is you can actually see your current current policies and change those so i'm going to first get this is like a bonus we're going to go ahead and get the execution policy and just pass it the command list so we can see it you notice in my machine as it came by default none of them are defined but we want to change the local machine here to be allowed and so what we can do is set execution policy unrestricted and this is the same as the warning is giving us in the previous command and i'm going to hit yes here to let that happen and then if we go ahead and list it again you can see the local machine now has it listed as unrestricted and again this command here is just the output that's shown right here and the other thing i'm getting is an error here related to can't find dependencies and it's pointing to this particular dll here unsatisfied linking error it says for the and if you see this what i've discovered is it has to do with a missing c plus plus visual c plus plus 2010 redistributable library so we can go ahead and install that as well what i've done is i've already gone to the download link in edge so you can go to this link i'll put this link in the description if you have the same error and we'll go down here and click on the download button and then because i'm using the 64-bit version of java i'm going to click on this with the x64 at the end and click next and let that download and and then we'll click on it to install it and it takes not very long i've read and i don't need to send any information to microsoft for this to work and we can go ahead and exit out now i'm going to clear the screen so on the command line if you ever want to clear the screen you type just cls and we'll try running cassandra one more time notice it says running an enhanced script start script and now it's showing an access violation and uh notice it's saying here um the seaguar library and um we can this is something that i've run into as well so what we can do is i'm going to go ahead and exit out of this and we can change the cassandra configuration to basically not use that not look up that library so i'm going to go to the again this is c apache cassandra and then i'm going to click on config and we'll go down to this file here it's a powershell file in fact if i if i show you um i go to options here and view and then click uncheck this hide extensions of known file types then we can see it's got a ps1 here at the as the extension so i'm going to open this and we can jump down to line 357 in the current version you can press ctrl g to jump to a particular line number in most editors including the standard notepad and so here it is um the line here and notices is pointing to adding cigar environment and you can google this if you want to know more information about that but we can just comment that out that's not necessary for cassandra to run and so i'm just going to comment that out for now while it's not working add a pound sign at the front and then i hit ctrl s to save or you can go to file and click click save as well i'm going to exit out of that i'm going to open up the command prompt again and we're going to navigate back to um the apache cassandra bin file and go ahead and maximize this and then we can type in cassandra and see if it runs now okay it looks like it's uh didn't exit uh it looks like it's running we can open up another command prompt and test that out so i'm going to just right click here and click on another command prompt so we can pop that up i'm going to navigate back to c slash apache cassandra slash bin and i'm going to type node tools node tools no tool and then status and this can give us the status of the current running instance so here you can see um that the status of our one node um is up and running we can see the host id and where it's running so if you don't see that that means it's probably still not working another thing we can test is the cassandra query language shell um so that's the cassandra query language shell that's how the abbreviation for it type that and launch it and since we installed python 2 this should work and so yeah we should be able to type in commands here to access our database as you can see here notice it's saying uh this warning that's missing this dependency pi relied so we can go ahead and install that if we want i'm going to type quit and then colon to exit out of this and we can do a pip install uh pi read line let that install really quickly and it's telling us that we shouldn't be using python 2.7 i agree but we need it for now it's also saying that it recommends updating pip so we might as well do that as well with this command here that it provides for us and now that that's set up we can type in cls to clear the screen and try the cassandra query language shell one more time cqlsh and notice uh that warning's gone so it seems to be working we still have this warning about uh code pages must be set um i don't think that's a a big deal for us but if you'd like to look into that warning you can also address that as well another thing that i wanted to mention we didn't run into it in this time in the video but i've have in the past depending on how much memory is in my system so if you have a lot of memory on your computer you might run into a problem where the java development or the java runtime can't load as much as it's cassandra's trying to do and so one fix for that again is to go to the c apache config and then but open here the jbm.options so i'm going to double click on that we'll go ahead and open it with notepad since that's all i have on this computer and if you scroll down this file towards the bottom there's a section called heap settings yeah so heap settings here and it talks about here a formula for setting how big the heap should be and notice it's set it's set to be the maximum of one half the ram um or the minimum of one half the ram or um at least uh this so so be at least one gigabyte and the minimum will be um a fourth of the ram or at most eight gigabytes and so if that ends up being too big you can fix that by uncommenting these so i'm just going to remove the pound signs here and this forces basically the maximum and the minimum size to be four gigabytes both so basically you'll have a heap of four gigabytes and you could change this you could change it to one gigabyte or you could change this g here to be an mb for megabytes but uncommenting these will set a specific caps heap size so if you run in that problem you can adjust those options here and then and then that should work and fix that problem anyways you can see uh there's quite a few hoops to run in to jump through to get apache cassandra running and it might be a little easier in linux one last thing that i want to set up is i don't want to have to go to this path in order to run cassandra so this is an optional thing if you just want to go to this path every time that's fine but let's add this location to our path in windows so that way we can access it from anywhere in the command line so i'm going to go ahead and exit cassandra from now i'm hitting just hit control c there to exit out let's go back to the environment variables so i'm going to search again here edit system environment variables and go down to environment variables here and we can do this in the system path or the user path and again the system path is for everybody i'm going to click on new and browse and we'll go ahead and browse to where cassandra was installed so that would be in the c drive and then apache cassandra and then inside bin that'll be what we want to add and we'll hit ok here and i can't click on the ok button here but let's see okay got through it uh because it was a little off the screen because i'm so zoomed in here and we hit ok now so now i can open the command prompt again and then from anywhere including here i should be able to type in cassandra cassandra and uh have it launch sure enough there it goes so that makes it a little easier i hope this video was helpful as always you're probably going to run into a few problems that i didn't but i tried to cover as many as i could given a fresh installed windows with nothing else on it and hopefully it's a little easier when version 4 is fully released so if you're watching this video at that time i definitely recommend trying cassandra 4 instead of cassandra 3 or if you want to jump back to my previous video on setting up with version 3.11.4 instead of 3.11.11 then you can try that as well but anyways hopefully you can figure it out and if not leave a comment or let me know if you have any questions thanks
Info
Channel: Programming with Dr. Hayes
Views: 4,240
Rating: 4.9663863 out of 5
Keywords:
Id: hJxlkHafYsQ
Channel Id: undefined
Length: 18min 45sec (1125 seconds)
Published: Sat May 08 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.