So, let's startup up that service again, confirm that it's open, there it goes. It takes a
minute to load up, and let's say that I don't want to run it on port 9200, I want to
run it on port 1150. So, how we do that we need to enter configuration file, and the elastic
search configuration file has the .yml extension. So, I'm gonna use "find" here to
look in "/etc" and the type that we're going to be looking for is a file, and the "iname"
is going to be "elasticsearch*" and here it is right here. So, I'm going
to "sudo nano /etc/elasticsearch/elasticsearch.yml and in this file, we're not going into the file too
much, but I'm just gonna find the part that configures what port it runs
on, which is down near the bottom.
That's the ip address, then the port here. So, the default is 9200, I'm gonna change it to 1150, and I'm gonna save
the file, and exit. Now if i refresh this it's still going to work on port 9200, it's not
gonna work on port 1150, and the reason for this is that it's still using
the old configuration file until the service is reloaded or restarted. So,
rather than typing you know elasticsearch stop and then
elasticsearch start, we can use one command and that is "sudo service
elasticsearch reload" "restart", sorry, and its gonna restart the service. So, now we
come back here, give it a moment, and then refresh, we're going to see that now
we're connected on port 1150 and if we were to go back for it 9200 it would no
longer work, and this is because the restart function has updated the configuration
file that it's running with. So, that's basically how you use a service, and we went
through the commands that I learned when I was learning Linux, and we don't use those
anymore. So, Ubuntu has moved to using upstart and system control so now a days how he
would do this, let's stop the service, is kinda in the same way. We're gonna use a different
program, though. So, I'm gonna type "sudo systemctl start elasticsearch"
change the port 1150, so essentially system control does the exact same thing that
the service command does, it just does it a bit differently, and that's probably
gonna become the standard way to do it in the future. So, I'd recommend you know
it's similar to stop the service, the only difference between using service
and system control is that in system control the action is before the program,
or before the service name. With service you type service, service name, and then action. So, that's the
only really important difference between the two.
I would use system control, get used to using that was a pretty sure thats whats
going to become standard. Thanks for watching!
In the next video, we're gonna be going over scheduled tasks.