Create An Elasticsearch Cluster On AWS EC2

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] today I'm gonna go over how you can create an elastic search cluster on Amazon ec2 instances so first thing of course is to bring up the ec2 instances so that's what we're gonna do right now so go to launch instance select the image you want to use and for a production easy to do instant you need some bigger ones but for the purpose of this video I'm gonna select the general-purpose et2 instance that has like four eight gigs of ram next we're gonna configure the number of instances we want to use and everything else we're just gonna accept the defaults also for in terms of production you also would want to add storage but but for this demo we're just gonna go without storage okay and I already have this key pair so I'm just gonna use this no okay and once you go on your ec2 console you're gonna see those instances being initialized and while that is happening let me just give them some descriptive names so he s 1 and s 2 okay now let's log into the first node and install elasticsearch on it and then we all repeat the same step with the other node so this is going to be the key pair file that we selected and easy to user that okay and we're gonna install elastic search through rpm so run this command to install elastic search and at the time of this video this is the most recent version of elastic search but whenever you are installing it make sure that you are using the most recent version or the version which you want to install and this is installed and we want to execute these couple of commands so that we are sure that this is set up as a service and as well as whenever the system reboots and the service comes up and this is going to be the command to start elastic search as a service but we're not gonna do that as we need to do some config changes now let's go and make the config changes the first confection which we want to make is the jvm options so go and read this file and we want the memory that gets allocated to elasticsearch to be more than what the default is which is usually very low and here I'm just selecting it's of 8gb system this system has a GB RAM so they're gonna you take half of that next we will go to this file where which where you specify the elasticsearch cluster settings as well as some other settings and then modify first the cluster name we call it yes demo and then the name of this node let's keep it like this node 1 and then after that we need to specify the host this should bind to so we'll just use the IP address of this host all right and after that we need to specify all the hosts that are part of this cluster and for that you use this config settings so this node itself is part of this cluster and then the other one would be there's a third ec2 instance which we are gonna set up very soon and let's also specify this parameter the initial master node and for that we'll just specify this one node as the initial master [Music] in the last thing that we want to specify is node master and for this node this is gonna be true because this is gonna be the master node now let's set up the other easy to instance so I'm gonna grab the public dns name and then I'm gonna login open it in another tab [Applause] okay we are logged in and then we're gonna follow the same steps that we did with the other node so elasticsearch have been installed on this host tube using the same steps as we did on the other host and have also prompted the JVM memory parameters now I'm gonna show you because this is gonna change a little bit I'm going to modify the elasticsearch config file over here for this node so the cluster name is gonna be the same which is yes demo node name should be different [Music] next is Network host all right so the network host is this one which is the private IP of this ec2 instance and then we go and modify the seed host so this we can just copy from here [Music] and then initial master it's gonna be the same as what is specified in the other node which is that the other node is gonna be the initial master and this is it as far as this node is concerned okay both config for both the nodes is done now we are gonna go back to the master node and then we're gonna bring it up so now they're gonna enter the system CTL command to start elasticsearch as a service okay it actually started because in in case we have had an error it would have output it to error so this is running now let's go back to the other node and run the same command so elastic search has been started successfully on this host as well let's check with the status command and now let's just check the health of our cluster so we're just gonna do a curl command here no what happened okay we didn't specify the port okay I think one thing which we missed is that we didn't open the port in our wall settings in ec2 so let's do that if you go to any of these two nodes that we brought up right both have the same security group so if you go here if you look at the inbound settings you don't have a rule for elasticsearch port now elasticsearch port default port is 92 but we're gonna select a range because the cluster communicate on ports between ninety two hundred and ninety three hundred and this is not a good practice in this case we should be using the security group but just for the purpose of demo I'm opening this up to anyone okay let's try now and as you can see now it worked and when you see the number of nodes this is two so there you go we have two node elasticsearch cluster setup [Music]
Info
Channel: 12 TECH
Views: 3,469
Rating: undefined out of 5
Keywords:
Id: EPPXk3gt_08
Channel Id: undefined
Length: 10min 13sec (613 seconds)
Published: Tue Jan 28 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.