InfluxDB 2.0 - Complete Guide to Getting Started with InfluxDB 2

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone this is brad from devops journey and today we're going to have a look at how you can install influx db 2.0 from start to finish it's going to be really easy really convenient for you guys that are looking to get into influx db and i'm going to show you how to install it using docker compose and this is my favorite way of installing applications is with docker compose it makes things really convenient and it makes your servers and applications a lot more portable so we're on docker hub for influx db you can pull the influx db image but i actually have a docker file that i've created for this and it's right here in my github check out the description below for this and i'll make sure to update these instructions with what we go over in the video but if we have a look at the docker compose file you can see that it's pretty simple here up at the top here just says the version of docker compose that this file is compatible with and then we have our services and just a single service under here which is influx db so we're going to use the influx db image we're going to listen on port 8086 and we have some storage over here and we're setting some environment variables for the influx db configuration so the next thing i'm going to do is provision a server on the cloud here using vulture you can use aws azure whatever you want just make sure it's something you're sort of familiar with we are going to have to open up port 8086 from the firewall so we can access this remotely so just make sure you know how to do that with your cloud provider and if you're using vulture you can just follow along because i'll show you in this tutorial so i'm just going to add a new server deploy a new server click cloud compute atlanta looks good for operating system let's do ubuntu and any of these are fine i'll just do 18.04 and then i want this one because the two dollar version is ipv6 only i want an ipv4 address so let's do this so my server is provisioning now so i will hop into an ssh session once this is up and running and i'll show you how to install docker compose and then run that docker compose file which is going to be your influx db server okay so my server booted up so let's go ahead and click on it here and just copy the ip address and then i pull up a tab here root at ip address yes and it wants this password here so throw that in and we are connected so clear the screen and let's start running the commands from uh my github repository here so we'll do an apt-get update uh make sure to do a pseudo and then i think if we do dash y it's going to automatically accept everything and it looks good everything's updated by default next thing we want to do is uh this is actually not pip install it should just be apt install so let's copy this and modify it so i'll go sudo apt install docker dot io and then uh sudo apt install docker compose i was thinking about python that's why i typed pip but it's actually apt install so let's do this and let's add the dash y flag here and there as well and this should just take a few minutes to install so i'll let this run and then once we have it up and running i'm gonna pull the code and then we're gonna run our docker compose commands okay it looks like the installation has completed uh let's clear the screen and let's do a docker ps and you can see there's no docker containers running but it accepted the command so everything seems to be installed let's go ahead and pull the docker file so i'll grab this url and just do a get clone and put that in here and let's hop in here take a look at the readme and it looks like it's just docker compose up so let's do that and i'm getting an error here and it's saying influx db storage doesn't exist so there's actually a problem with my docker file so little live troubleshooting never hurt anyone so let's go open this up in nano and you can see this is the line that it doesn't like basically it's mapping this directory to influx db but there's no reference to this in the file so that was my mistake uh when i copy and pasted this from a different project i forgot to put in the volumes i'll make sure to fix this before i push it out to github so by the time you're watching this this is already going to be fixed but i will add it here for myself so we'll go volumes and then we'll go influx db storage and you can just leave everything blank here and there we go so let's rerun the command docker compose up and you can see it's pulling the image and you can see it's bringing up influx db this is scrolling by pretty quickly here but it looks like it's running i'm going to go ahead and open up another ssh session so go ssh root at throw in the ip and then put in the password there we go and if we go docker ps you can see that influx db is running on that port so everything looks good if we go curl local host and then throw in that port you can see that it is giving us some results so that's good but now i want to access it remotely from my workstation so i'm going to go ahead and do that the first thing i want to do is make sure that this port is open so i'm going to go into vulture and then i'm going and then i'm going to go to settings and then i have firewall settings here and it doesn't have a firewall set so let's go manage and i'm going to create a new firewall and let's add a new firewall group and we'll go influx app so obviously we need ssh open to manage it and then we also need port 8086 so we'll just select tcp 80 86 uh and i'm gonna say anywhere but i recommend using my ip address and i'll make it so only you can access it and not someone else just keep in mind if you're going to try to access it from different locations then you will need to add multiple ip addresses in there but since i'm just going to destroy this lab at the end of this video anyways i'm just going to leave it as anywhere and then i usually have problems with this saving unless i go add additional firewall rule and that usually saves it for me i think it's just sort of a weird gui that i need to hit the plus sign twice but the firewall is set up now let's so let's go back and i might actually need to apply it to my server so let's go back to manage my server and select it and make sure it's updated and there we go we should be able to access it it might take up to two minutes for the changes to take effect but let's go ahead and try it now let's just copy this put it in here and go 8086 and there we go we can see that we can get to the server so let's put in the credentials so we'll go admin and the credentials i have are actually in that docker file so let's pull them up here go to docker compose and then change me please throw that in paste it sign in and sure why not save that so this is the influx db gui it's actually pretty nice i think this is new to version 2.0 so let's go ahead and explore it if you go underneath data you can see that there's a couple different things here the client libraries this is actually really convenient so i do a lot of python programming and one thing you can do is just go over to python here and it gives you everything you need to know to set up a python script to connect to this database so you can see you do a pip install influx db client and then it gives you examples on how to initialize the clients how to write data and yeah it gives you three different options on how to write the data and then how to actually pull the data so you can just copy it to your clipboard paste it into your script and it should be good the next thing to do here is go to data and then go to buckets so you can create as many buckets as you want in the docker file we created a bucket by default so you can see my bucket is there by default and of course you have your settings so you can delete the data older than a specific date uh if we hop on over here to tokens this is where you generate your token um so just go up here you can do read write tokens all access tokens and basically this is going to be the token that you use for accessing influx db with the applications that you build if you go to telegraph this is where you can set up telegraph configurations basically telegraph is used for monitoring servers you can install a telegraph client on a server and then have it push metrics to influx db that way if you go to explore this is where you can explore the data we haven't pushed any data to this database yet so it's not very interesting right now but if we did push data to influx db then this is where you would see the data coming up if you go to boards this is where you create dashboards and then the rest is just sort of tasks alerts and settings so the next thing i'm going to do is push some data into influx db and then we'll have a look at how it looks there and then i'm going to show you how you can integrate another application like grafana and have it pull data from there okay so let's move ahead here and let's actually go back to this data section let's go underneath telegraph and let's have a look at how we can set up telegraph on our actual server and push some data into influx db so i think we just go create configuration and you can see that there's default templates here so you could have telegraph monitor docker kubernetes nginx redis or just the system so i'll just use system here for some basic monitoring this is going to be all the measurements that it's taking it's going to be taking measurements on your cpu usage disk memory all that good stuff so i'll just go crate and verify and it gives us the instructions on everything we need to do so first we install telegraph on the system then we configure the system with our api token this is so our system has permissions to push to influx db and then we set up the telegraph configuration and basically that configuration is just telling it influx db's ip address and port which you can see matches up here so let's go ahead and have a look at the installation instructions and we already have influx installed so we want telegraph installed so let's select ubuntu and this looks pretty easy so it's just going to pull down the package and then install it so let's copy that and paste it in here and now telegraph should be installed so let's head on back to influx copy this token to the clipboard paste that in and then uh let's do the copy configuration and paste it in and now you can see that it looks like it's trying to push data so let's go back to influx and go listen to data and you can see connection is found so we look like we're all good here let's go ahead and hit finish and now let's go back to our explore tab and you can see that now there's a bunch of data in here we have options to filter on all these different things so if we go cpu and just click on a bunch of things hit submit you can see that there isn't a lot of data here yet since uh it just started taking these measurements let's uh go system uptime maybe there we go you can see this is a measurement that we can see right away and it basically tells you when the system first came online so obviously if you leave this running for a while it's going to be collecting data and you're going to have a lot more data in your graphs on how the system is running uh the next thing you could do is actually go to boards and you can create your own system dashboard so go create dashboard new dashboard it looks like you can customize things here i haven't really used this much to be honest but let's see what it looks like and there we go we'll do that and there we go we have the first cell in our dashboard so you can just go through and add all the metrics that matter to you i'll go processes total there we go and what a lovely dashboard we have already so pretty nice out of the box stuff usually you would have to install something like grafana to get dashboards like this but you can see that out of the box functionality this is actually pretty good so i'm actually going to pause this video let the server run overnight come back and have a look at it tomorrow and see if we can have a dashboard with some useful information in it so i'll see you guys soon all right so i left my server running for quite a few days here actually about six days and uh when i logged back in and went to boards i noticed that this system dashboard got automatically created and when you go in there you can see that it automatically put in all the metrics that telegraph was tracking and now influx db has automatically created a dashboard based on that so you can see it gives you quite a bit of information about the system we got our system uptime the amount of cpus system load total memory memory usage and everything like that and yeah this dashboard was just automatically created basically all we had to do was install telegraph on our server as well as install influx db on another server and then you can do that monitoring so it just goes to show you how powerful these tools can be and they're actually quite easy to set up so anyways if you enjoyed this video go ahead and hit that like button for me and if you want to learn more about influx db or other devops tools go ahead and subscribe to my channel thanks so much for watching and i hope to see you all in the next video
Info
Channel: DevOps Journey
Views: 7,500
Rating: 4.7192984 out of 5
Keywords:
Id: -gF-Jsk85bQ
Channel Id: undefined
Length: 17min 49sec (1069 seconds)
Published: Fri Jul 02 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.