Storage Nodes

16 minutes
Share the link to this page
Copied
  Completed
You need to have access to the item to view this lesson.
One-time Fee
$69.99
List Price:  $99.99
You save:  $30
€67.28
List Price:  €96.12
You save:  €28.84
£55.93
List Price:  £79.91
You save:  £23.97
CA$98.01
List Price:  CA$140.02
You save:  CA$42.01
A$107.87
List Price:  A$154.11
You save:  A$46.23
S$94.42
List Price:  S$134.90
You save:  S$40.47
HK$544.78
List Price:  HK$778.29
You save:  HK$233.51
CHF 62.22
List Price:  CHF 88.89
You save:  CHF 26.67
NOK kr779.46
List Price:  NOK kr1,113.56
You save:  NOK kr334.10
DKK kr501.79
List Price:  DKK kr716.88
You save:  DKK kr215.08
NZ$119.98
List Price:  NZ$171.41
You save:  NZ$51.43
د.إ257.07
List Price:  د.إ367.26
You save:  د.إ110.18
৳8,402.58
List Price:  ৳12,004.20
You save:  ৳3,601.62
₹5,911.93
List Price:  ₹8,445.97
You save:  ₹2,534.04
RM312.68
List Price:  RM446.70
You save:  RM134.02
₦118,358.68
List Price:  ₦169,091.08
You save:  ₦50,732.40
₨19,451.98
List Price:  ₨27,789.74
You save:  ₨8,337.75
฿2,421.30
List Price:  ฿3,459.15
You save:  ฿1,037.85
₺2,419.75
List Price:  ₺3,456.94
You save:  ₺1,037.18
B$406.81
List Price:  B$581.19
You save:  B$174.37
R1,266.21
List Price:  R1,808.95
You save:  R542.74
Лв131.43
List Price:  Лв187.77
You save:  Лв56.33
₩98,455.31
List Price:  ₩140,656.47
You save:  ₩42,201.16
₪260.61
List Price:  ₪372.31
You save:  ₪111.70
₱4,125.84
List Price:  ₱5,894.31
You save:  ₱1,768.47
¥10,813.84
List Price:  ¥15,449
You save:  ¥4,635.16
MX$1,432.62
List Price:  MX$2,046.69
You save:  MX$614.07
QR256.35
List Price:  QR366.23
You save:  QR109.88
P959.91
List Price:  P1,371.36
You save:  P411.45
KSh9,063.70
List Price:  KSh12,948.70
You save:  KSh3,885
E£3,476.67
List Price:  E£4,966.88
You save:  E£1,490.21
ብር8,762.26
List Price:  ብር12,518.05
You save:  ብር3,755.79
Kz63,877.12
List Price:  Kz91,256.94
You save:  Kz27,379.82
CLP$68,152.06
List Price:  CLP$97,364.26
You save:  CLP$29,212.20
CN¥507.37
List Price:  CN¥724.85
You save:  CN¥217.47
RD$4,236.71
List Price:  RD$6,052.70
You save:  RD$1,815.99
DA9,355.50
List Price:  DA13,365.57
You save:  DA4,010.07
FJ$159.32
List Price:  FJ$227.62
You save:  FJ$68.29
Q542.77
List Price:  Q775.43
You save:  Q232.65
GY$14,710.67
List Price:  GY$21,016.15
You save:  GY$6,305.47
ISK kr9,775.50
List Price:  ISK kr13,965.60
You save:  ISK kr4,190.10
DH703.21
List Price:  DH1,004.63
You save:  DH301.41
L1,276.61
List Price:  L1,823.81
You save:  L547.19
ден4,112.73
List Price:  ден5,875.58
You save:  ден1,762.85
MOP$563.70
List Price:  MOP$805.33
You save:  MOP$241.62
N$1,272.29
List Price:  N$1,817.64
You save:  N$545.34
C$2,573.53
List Price:  C$3,676.63
You save:  C$1,103.10
रु9,461.06
List Price:  रु13,516.38
You save:  रु4,055.32
S/267.08
List Price:  S/381.56
You save:  S/114.48
K283.05
List Price:  K404.37
You save:  K121.32
SAR262.80
List Price:  SAR375.44
You save:  SAR112.64
ZK1,938.90
List Price:  ZK2,769.98
You save:  ZK831.07
L334.76
List Price:  L478.25
You save:  L143.49
Kč1,707.89
List Price:  Kč2,439.96
You save:  Kč732.06
Ft27,663.65
List Price:  Ft39,521.19
You save:  Ft11,857.54
SEK kr779.03
List Price:  SEK kr1,112.95
You save:  SEK kr333.92
ARS$70,272.32
List Price:  ARS$100,393.34
You save:  ARS$30,121.01
Bs485.83
List Price:  Bs694.07
You save:  Bs208.24
COP$310,661.31
List Price:  COP$443,820.90
You save:  COP$133,159.58
₡35,743.76
List Price:  ₡51,064.70
You save:  ₡15,320.94
L1,776.85
List Price:  L2,538.46
You save:  L761.61
₲551,865.53
List Price:  ₲788,413.13
You save:  ₲236,547.59
$U2,996.30
List Price:  $U4,280.61
You save:  $U1,284.31
zł292.33
List Price:  zł417.63
You save:  zł125.30
Already have an account? Log In

Transcript

Video 3.7 storage nodes. In this video, we'll learn how to use storage nodes from your pallet. So why do you need storage nodes? But first, what are storage nodes? These are nodes which help you store your data in your database. And why would you need that?

It's because you don't want to lose your data within no trade. You fear what happens if node red crashes one day? What happens if all my data is gone? That is why we have the storage nodes in Node red. These nodes help you in connecting with databases and storing your data looks elementary and it is actually foolproof, trust me. In this video, I will be briefing you on three essential storage nodes Cloudant Sq light and Cloud object storage I'll explain what each of them means and how to use them.

Okay, I'm sure you have a question for me, is it? Can I only use these three nodes? Doesn't know don't have any other databases linked to it? Of course it does. If you want to know what else is there, you need to check it in the Manage palette. You can see my SQL MongoDB.

Oracle, get it. It has both SQL and no SQL databases. So not to worry. The three nodes that I teach you are different from each other. And that way, I think you learn to use any database note there is the first of the more or less Cloudant cloud and cloud. Yes, it is a cloud based database service offered by IBM.

And we're going to start with that because it's in the cloud. is a no SQL database, which means the structure needn't be predefined. It stores data as JSON documents. If you want to know more, now would be the right time to pause this video to check out the link in the resources and learn what it is. Like I told you before, it is a service offered by IBM. And if you've noticed, there is already a service instance of Cloudant running on your org.

Now let's check out the service. Click on launch Cloudant database to launch it. Here, you can see that there is already a database created called note read. This one has all of your node read flows, so don't even think about deleting it for fun. Now, let me show you how to create a new database. See, that's all it takes for you to create a new database.

Now let's add some data into it via no dread We need the Cloudant out node to store our data. Whenever you start using a new node, go through the node help doc to get started with it. We can inject some data into this using the inject node. So let's connect that. First, let's configure the inject node. Now remember, Cloudant collects Jason.

So let's send JSON data, let's say state hungry. Now let's configure the cloud in Node. As you can see, the service is automatically detected because the database is in the same services, no dread. You just have to mention the database you need to connect with and in my case, it is la kr dashDB. Note that you should not use no dread because it would be hazardous. We have two options here to insert and to remove In both cases, we can pass the whole object or the message dot payload property alone.

I'm going to send only my message dot payload property, you can try sending the whole message object also deploy and inject. I'm going to inject three times. No errors. Let's see, refresh. And there you see it. three entries.

The payload went from the inject node. The other two, underscore ID and underscore rave are created by the Cloudant itself. You need to pass these in the message object to update and delete the data associated with underscore ID and underscore rave. What happens if we inject on the same ID? Let's check that we can copy this ID and use it in the injection See, it throws an error, fail to insert document, couch returned four or nine, which means conflict. This is because the underscore Id already exists.

So how do I update this document. For that, you need the other cloud into node we saw before, which will return the data you searched for. So first, we'll search for the ID. So we will configure this node accordingly. Since we have to search the ID, we have to pass that alone as a parameter. So let's remove the state parameter.

Then we can change the message dot payload dot state, to whatever I'm feeling now, or you're feeling now using the change node. Just stuffed myself with bunnies. It's cottage cheese. So I'm feeling satiated. I'm going to update the same. Let's see.

There you go. Now let's try deleting the same ID because that is what is left. We need to select Remove instead of insert. We don't need any other nodes. deploy the app and inject error. This is you need underscore ID and underscore riff To delete a document.

Okay, let's add the underscore ref to let's check out what has happened. terminated. Good see within minutes you learned how to create, update and delete documents in Cloudant. One important thing to note is the Cloudant database page can sometimes ask for authentication without even you setting any credentials. In that case, you have to create new service credentials from the service page and use it here. We'll see how to create one soon in this video.

Next, we can look into Cloud object storage, which is also a service offered by IBM cloud. So why should we go for Cloud object storage? Wait, what is Cloud object storage in the first place? Cloud object storage, like the name says, is an object storage and not a database. So what's the difference? Well, for that you want to know what an object is.

In this sense. Objects are nothing but large sets of unstructured data like music, videos, documents, and pictures. And in this case, we store these objects in the cloud. So when do you go for object storage? When you want your content to be always available, an impatient user like me, will want to access my data very quickly. When you want to access your data content from anywhere, and from any device, every object has three things, the data itself, its metadata, and a globally unique identifier.

The data, like I told you before, can be anything like books, photos, videos, music files, etc. The metadata tells about what the data is, what it should be used for, its confidentiality, and more. This can be customized because of which it helps in faster data retrieval. The globally unique identifier helps To retrieve our data from a globally distributed system, a typical example would be valet parking. When you go to an airport and you give your car keys to the valley, and he gives you a ticket, which is a unique identifier in return, he can park your car anywhere you need not know about it. Once you return, you can show the unique identifier and get your car back.

Another feature of the object store is that it supports cross regional storage of your data. So if your data is stored in America, and then you move to Europe, it will be slow for you to read it. So in an object store, there are multiple copies of your data pushed in different regions, which is a configuration option and it comes with a price. Another thing to note is that you can archive large data sets at low costs cheaper than the traditional databases. To know more about this, find the appropriate link in the resources and go through it. Like I told you before, CLS is a service present in the IBM Cloud, so we have to install it into your application.

Let's do that first. After adding it, we have to create a bucket. You need to give a unique name here. You can choose your region and resiliency and click Create. There you go. Now we have to get some service credentials.

To use it in Node red. Click on New credentials, since we don't have one already. You can change the name leave the rest of the options as it is and click Add. Make sure you have writer access. Okay, that is all you have to do here. Now go to no dread.

You can notice That SEO S is not installed by default. So you have to install them separately using the Manage palette. After it has been installed, you can find them in the palette. You can find four of them, get, put, delete, and query. These are all self explanatory. We will use the put node to save some audio files and some pictures.

For this, we need to install a set of nodes from browser utils. We have installed a camera node and a microphone node. From these you can see that the camera generates an image file and the microphone generates an audio file. Okay, now let's add these and configure the CEOs put node. Remember I had put a p cross region and you can get the API key from the service credentials you have created. You can get the service credential From here, add a name and click Done.

Here, you have to add your bucket name, you must set the mode as message dot payload. Because the image is sent in payload property by the camera, and the camera node produces a file. png. So set it up here. Don't forget to add the object name with an extension. That's it.

I have added debug node on the other side just to see what it is returning. Deploy and check. When you click on the camera button, it triggers your laptop camera, which will ask for permission. Now it's taking a picture of me. Super, the images sent as arrays of bytes in the message dot payload. Now we can go and check the bucket.

You have to download the file to view it. That's me. Okay. I want you to try the microphone output. Just like we did the camera node by yourself. I have added a flow in the resources for you to try out the other CEOs nodes.

The next is Sq light nodes. sq light is a small lightweight sequel based database. It is a popular choice as an embedded database for local storage in application software. To know more, check out for a link in the resources. We can test these nodes in our pie because it is easy to install SQL lite in the pie and use. The nodes again are not installed by default.

So you have to install it from the menu. ballot will install SQL lite on RPI. I have attached a file, which contains all the commands you need to run on your PI. To install SQL lite along with the explanation of why you should run them. Use them to install. After installing, come to node red and configure the Sq like node.

Give some name here and make sure you select message topic. I have added a flow file which contains four inject nodes with SQL queries as its topics because that is how we're going to send them add a debug node at the other end of the Sq light node to see what happens when you inject the flow. I have included Link in the resources, which will help you start off with SQL queries. If you haven't used it before. I have also included a link in the resources section. If you want to learn SQL queries, connect all the four inject nodes to the SQL lite node and deploy the flow.

Now try injecting one by one from the inject node and see what happens. During this inject, you can see that it shows the output of the Select query. When you delete, everything will be gone. You can cross check what's happening from the RPI too. So that's it for this video. In this video, you've learned the different types of storage nodes we can use with node red.

In the next video, I will introduce you to a special class of nodes, called the dashboard nodes.

Sign Up

Share

Share with friends, get 20% off
Invite your friends to LearnDesk learning marketplace. For each purchase they make, you get 20% off (upto $10) on your next purchase.