How to start Redis locally with Docker & Get started with Redis Insight

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
in this video we're gonna run ready server local in a docker container alongside redis insight and redis command line interface let's check it out [Music] my journey with brady started one video ago and in my previous video i discussed 10 things i didn't know about radiss and listed many of its powerful capabilities most people are unaware of i'm very interested in understanding and experimenting with brady's capabilities and this is another video of a series where i am documenting my experience with bradies from a beginner's perspective join me in this adventure in this tutorial you will learn how to run radis locally alongside redis inside to manage its data and how to perform simple credit operations and in addition we'll also see how we can perform the same operations using the radius command line interface and how to connect to it from within a docker container if you still don't know me my name is rafael de liu and in this channel i talk about software development if you like this kind of content don't forget to slap those like and subscribe buttons and now let's put our hands in the fire side starting a ready server local is very easy and running it with red is inside it's even easier for running then we're going to use docker and although we're running both applications i will leave the command to run only the server as well so as you can see down here let me try to make it a little bit bigger yes um the first command is to run only the server right so that's why we're exposing only the 6379 port while the second command is to run the whole stack with red is in sight as well and that's why we're exposing two ports from this container the 63 79 and the 8001 right this is the one for redis inside and this is the one for the ready server and let's run this one here so let me copy and paste this on the terminal it's saying that it couldn't find the image locally so it's gonna be downloading the image okay download it and it started so if you do docker ps nice you can see that we have our redis stack container running right it's exposing this shoe port 6379 and 8001 and yes we're now running the redis stack container locally in our machine let's try to connect to it right so this is the page in red is for all the commands but that's not what we're looking at right now you want to go to this page right here localhost 8001 right at 8001. let's see if we can connect nice to starting all right so we need to accept the the terms and conditions for the license now we're in we're in our database so on this side you can see some database stats on this side if you click here on my redis database you can actually configure a username and password and also configure a tls connection and also check some information about your instance such as the modules that came with the docker image right so you can see that we have already ready search red is jason the reddish graph and reddish time series and red is bloom installed natively in this image so let's close this and in this port you can see the list of keys that we have inside redis right and here you can see the details of this key values but remembering that conceptually radius is based on the key value database paradigm so every piece of data is associated with a key either directly or indirectly so our first key is going to be of type hash the ttl which is the expiration for the key is going to be empty which means it will never expire right and the key name i'm going to add my own name here so let's say just a file delu all right and let's add some fields here so let's say name and then have file let's add another one and then last name and let's say the leo right and let's say job and software developer and finally my age which is 27 and let's add the key you don't see the key on this side right away right but you can see that it was last refreshed three minutes ago so let's refresh this side of the screen now we can see that our key is on the left side so we have half elio it's a hash and you can see the details on this side so let's say that you want to edit this key i'm not a software developer anymore now i am a software engineer so now i just updated this this key i can even add new fields to it i can delete fields and i can even delete the whole key right away how can i achieve the same thing from the command line interface in order to send commands to redis we need to connect to redis command line interface we can access it by running this command in our terminal right here so i'm in i'm inside the server with the command line interface and let's see what we can actually do here right so we already have a key so what i'm gonna do is i'm going to do h get and then you see that it already suggests that i have the key and the field which is pretty cool actually so let me put i'll fail the liu all right so it returns software engineer let's try to get all the fields so i'm gonna do a h get all right and i just need to add the key here right and it returns everything so name last name job and age right so let's try to add this key and let's do each set this is this is really cool actually uh rafael de liu and then i'm gonna change my age i'm not 27 anymore my birthday was right now and now i'm 28. and let's check again all right it changed my it changed this field of the key right so now you can see that it's 28 and not 27 anymore what if you wanted to delete the age i don't want you to know my age of course right so what i'm gonna do is hdl and then i'm gonna do i'm gonna write the name of the key and after that i'm gonna write the name of the field all right and let's see what we get now okay so how far the liu doesn't have an age anymore nice and what if you want to add a new key so you can do it by running h set right and i'm going to add here arthur de leo who is my my brother and i can already add all the fields here as you can see right so i'm gonna name artur last name oh i forgot you i forgot the quotes all right name artur last name the you right brother of have file delio and job being a files brother nice let's press enter you can see that it returned four because it added four fields to this key and now let's try to return all of them so get all and you can see all of them being added here right so now let's try to delete it to delete it we just need to say dow and then select the key i'm gonna delete only my brother all right and now if i do h get all r3d leo what you see is that it's an empty ray that this key is not registered there all right and that's pretty much how you do those same things that you saw right there right all right but what about all the other types that you saw here in this list right because i can add a hash i can add a list a set sorted set so let's go briefly through each of them and let's start with the strings so the strings are the most basic kind of reddish values and they are binary save which means that a red is a string can contain any kind of data for instance a png image or a serialized object for example right the ttl is the is the same thing right so it's the time to expire we're gonna leave it as no limit and here we're gonna add like my string and i'm going to enter value for this this is my string example i'm just going to add the key right and you can see that it exists here now and if i refresh on the left side i have my new key on redis as well right and then if you go back to the command line interface you can even do get my key pay attention that this command now is a little bit different from this one right because the h here was referencing that it was a hash well this is for strings right so if i get yeah my string you can see that it returned my string but if i try to do h get my string it's going to return an error because it's not a hash then we also have lists right so let's add here my list and let's add the first element first and let's add the key and then you can see that we can add new elements to this list right and you can also decide if you want to push to tail or push to head so to the end or the beginning of the list right let's add a second here nice you can see that i have first and second and the index as well and if i want i can also push to the head and i can do like zero let's see what i get nice so now the index zero is the element zero one is first and two is second let's add two more elements so i'm gonna add three to the tail so it's gonna have the index three right and i'm gonna add a new one to the head which is gonna be minus one and then my index zero is minus one and then if you come back to the terminal here and we do l range for example and then you can do my list right and i want to see it from index 0 to 3. so let's see what it returns all right let's do -1 and it should return the whole list and then you can see all the elements of this list all right pretty cool let's add a new key but before let's refresh on the left side so you can see our list here so ready sets are an unordered collection of strings and it has a desirable functionality of every set of course that if you try to add the same element multiple times in the end you're gonna have only one copy of this element within your set right let's see how it works here so i have my set and then i'm gonna add here arthur and also half io and let's add the skis okay pretty cool so let's add someone else here let's set gabrielle okay let's save this all right so i also added not on purpose and empty string and it was was saved here and you can see that the order changed right and let's refresh on the other side here now okay so you can see the set the string the hash in the list and now and now let's try to add a new key here and let's add a sorted set so a sorted set is very similar to a set right you cannot have repeated members but what if but what you have now is a score so it's actually ordered by a score so let's say my ordered set right and now let's say arthur and let's add his age here so he's 30 right and i am rafael and i am 27. now let's add someone else here gabrielle who is 25 right and now if i add this you can see that i can order by the score right which depending on your on your user case might be very useful all right what else do we get do you we also have a json right so let's set my json here my json and then all right so let's create a json object name file and age 27. so a nice functionality of red is json is that you can actually add it only a single field right or even add more fields here right so i could have something like let's say test and that's true let's see if it works okay it should have the correct syntax pretty nice that's what i was actually expecting so i could add another object within this so name of new object new name all right let's see what i get okay that's pretty cool so now we have another object inside the the task field really nice let's try to add a list here now my list and let's do it like this okay and let's have another object inside this list and let's say name again not very creative today and new name and let's add it okay that's pretty cool and i have my list and the first element of the list is name new name is an object with this variable right here okay let's refresh on the left side and we get here our json object my json nice okay so let's add our last kind of object which is a stream okay so a red is a stream is a data is a data structure that acts like an append only log and they are very useful for recording events in the order that they appear right so let's add one here so my stats let's say every entry in uh in a stream key needs an id requires an id right and you can see that if we use a store and click here on the information you'll see that redis will auto generate the id based on the database current timestamp right which is which is what we're looking for right now so let me add um a field here so this is going to be statues and then let's say off right so let's add the key okay so you can see that it was off at this time and now let's add a new entry and then statues on right and then statues again and on again right so we have a stream of data where we use the timestamp of the database to check the status of something right that was off and then it was on and then it was on again all right let me let me get this from behind my back oops that red is inside it's kind of heavy oh all right stay there okay sorry about that all right so in this video we not only learned how to run the ready server locally alongside with red is inside and the redis command line interface but you also learned about the different types of keys that you have within radis and how to perform a few simple cred operations i hope you have enjoyed this video in my next videos i'm going to be bringing more content like this i'm going to be talking more about red is in this adventure that i am going through right now uh so if you like this kind of content don't forget to subscribe to my channel and see you around
Info
Channel: Coding with Raphael De Lio
Views: 13,141
Rating: undefined out of 5
Keywords: redis, redis server, redis insight, redis database, realtime, redis cli, redis docker, docker, container, redis container, locally, local, redis local, redis on premise, insight, get started, get started redis, redis keys, keys, key value database
Id: 4vWAMMFjwd0
Channel Id: undefined
Length: 16min 50sec (1010 seconds)
Published: Mon Aug 08 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.