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.10
List Price:  €95.86
You save:  €28.76
£55.67
List Price:  £79.54
You save:  £23.86
CA$100.49
List Price:  CA$143.56
You save:  CA$43.07
A$111.96
List Price:  A$159.95
You save:  A$47.99
S$94.87
List Price:  S$135.54
You save:  S$40.66
HK$544.16
List Price:  HK$777.41
You save:  HK$233.24
CHF 62.56
List Price:  CHF 89.37
You save:  CHF 26.81
NOK kr792.29
List Price:  NOK kr1,131.89
You save:  NOK kr339.60
DKK kr500.54
List Price:  DKK kr715.08
You save:  DKK kr214.54
NZ$123.74
List Price:  NZ$176.78
You save:  NZ$53.04
د.إ257.07
List Price:  د.إ367.26
You save:  د.إ110.19
৳8,330.24
List Price:  ৳11,900.85
You save:  ৳3,570.61
₹5,945.56
List Price:  ₹8,494.03
You save:  ₹2,548.46
RM315.51
List Price:  RM450.75
You save:  RM135.24
₦108,149.19
List Price:  ₦154,505.46
You save:  ₦46,356.27
₨19,403.53
List Price:  ₨27,720.51
You save:  ₨8,316.98
฿2,393.75
List Price:  ฿3,419.79
You save:  ฿1,026.04
₺2,454.67
List Price:  ₺3,506.82
You save:  ₺1,052.15
B$425.95
List Price:  B$608.53
You save:  B$182.58
R1,282.09
List Price:  R1,831.63
You save:  R549.54
Лв131.15
List Price:  Лв187.37
You save:  Лв56.21
₩101,234.93
List Price:  ₩144,627.53
You save:  ₩43,392.60
₪254.67
List Price:  ₪363.83
You save:  ₪109.16
₱4,117.86
List Price:  ₱5,882.91
You save:  ₱1,765.05
¥10,949.58
List Price:  ¥15,642.93
You save:  ¥4,693.35
MX$1,405.49
List Price:  MX$2,007.92
You save:  MX$602.43
QR254.12
List Price:  QR363.05
You save:  QR108.92
P963.49
List Price:  P1,376.48
You save:  P412.98
KSh8,999.72
List Price:  KSh12,857.29
You save:  KSh3,857.57
E£3,561.31
List Price:  E£5,087.81
You save:  E£1,526.49
ብር8,689.79
List Price:  ብር12,414.52
You save:  ብር3,724.72
Kz64,250.82
List Price:  Kz91,790.82
You save:  Kz27,540
CLP$69,143.42
List Price:  CLP$98,780.55
You save:  CLP$29,637.13
CN¥510.67
List Price:  CN¥729.56
You save:  CN¥218.89
RD$4,244.94
List Price:  RD$6,064.47
You save:  RD$1,819.52
DA9,440.04
List Price:  DA13,486.35
You save:  DA4,046.31
FJ$162.13
List Price:  FJ$231.62
You save:  FJ$69.49
Q537.12
List Price:  Q767.35
You save:  Q230.22
GY$14,584.29
List Price:  GY$20,835.60
You save:  GY$6,251.30
ISK kr9,693.35
List Price:  ISK kr13,848.23
You save:  ISK kr4,154.88
DH701.59
List Price:  DH1,002.31
You save:  DH300.72
L1,285.64
List Price:  L1,836.70
You save:  L551.06
ден4,127.89
List Price:  ден5,897.23
You save:  ден1,769.34
MOP$558.06
List Price:  MOP$797.27
You save:  MOP$239.20
N$1,283.39
List Price:  N$1,833.49
You save:  N$550.10
C$2,565.21
List Price:  C$3,664.75
You save:  C$1,099.53
रु9,482.30
List Price:  रु13,546.73
You save:  रु4,064.42
S/259.58
List Price:  S/370.84
You save:  S/111.26
K282.68
List Price:  K403.85
You save:  K121.16
SAR262.90
List Price:  SAR375.59
You save:  SAR112.68
ZK1,929.21
List Price:  ZK2,756.13
You save:  ZK826.92
L333.95
List Price:  L477.10
You save:  L143.14
Kč1,686.22
List Price:  Kč2,408.98
You save:  Kč722.76
Ft27,781.83
List Price:  Ft39,690.03
You save:  Ft11,908.20
SEK kr772.17
List Price:  SEK kr1,103.14
You save:  SEK kr330.97
ARS$71,242.69
List Price:  ARS$101,779.64
You save:  ARS$30,536.94
Bs481.71
List Price:  Bs688.19
You save:  Bs206.47
COP$305,135.87
List Price:  COP$435,927.07
You save:  COP$130,791.20
₡35,171.10
List Price:  ₡50,246.58
You save:  ₡15,075.48
L1,769.55
List Price:  L2,528.04
You save:  L758.48
₲543,563.42
List Price:  ₲776,552.46
You save:  ₲232,989.03
$U3,109.25
List Price:  $U4,441.97
You save:  $U1,332.72
zł286.15
List Price:  zł408.81
You save:  zł122.65
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.