28:16
2025-01-27 13:22:37
2:15:00
2025-01-27 15:12:42
2:08:39
2025-01-27 15:41:27
2:16:52
2025-01-27 20:41:38
3:55:27
2025-01-27 20:41:42
4:47:11
2025-01-28 08:47:09
Visit the Mongo DB for Administrators course recordings page
WEBVTT--> I love you. --> I love you too. --> I got these ones. --> Bye. --> Oh --> Oh --> Oh --> Three five minutes also, I'll be with you guys --> Morning --> Morning, okay, cool. Yeah --> Any questions from yesterday I --> Presume none --> Okay --> So we will continue just one second --> Okay --> Can you guys see my screen --> Yes, okay cool now, let's continue today and talk about --> Divers right --> When when you're writing code right for those that were developers mainly or if we're developers --> You there is a way to be able to write --> Um --> Code that we can set data into --> The database remember there is the there is the one of writing a query part --> Right when you're in the database in itself and then when you're using programming languages different programming languages --> Yes --> Oh, yes, please --> Thank you --> Let me know when you're ready when it's when it starts recording. Yes, thank you --> Uh --> Okay, can you see my screen? Okay, so um --> So I was saying when when you are writing code in different languages your Java your Python, you know --> There is there is a communication that needs to happen between the database and the application in itself --> And what MongoDB uses is what you call drivers, right? --> So the interaction between the language in itself or the library module or --> The the language in itself and the database is mainly connected or interact the interaction happen using what you call a driver --> And what is the driver? It's a library or module that allows your application right to communicate with MongoDB --> Yes, oh, oh I was a mute sorry guys --> Sorry, I forgot that it's --> When you start recording when your side --> Goes on mute and whatnot, but anyway --> So I was saying that --> The communication between a language right specific programming language and MongoDB is --> Done using what you call a driver, right and what is the driver? --> It's merely a library or module that allows your application to be able to communicate with MongoDB, right? --> Mongo the driver obviously will handle the lower level details of --> Connecting to the database sending the queries receiving the responses and all that stuff, right and --> with --> Mongo it has official drivers for many languages, right your Java your Python your Perlin all that stuff and --> Key responsibilities of those --> Of those mongodrivers is first connection management it establishes the connection and manages those connections --> To the mongodb server, right? --> When you write a query when you send a query --> It handles that from the programming language is converted to whatever is mongodb --> Related side of it and also converting data between the database --> Databases bson and the language, right? --> So it still needs to give an output that is understood by the programming language that you're that you're using so that conversion --> From the programming language to bson and then from bson back to the programming languages, right? --> It also is able to handle errors, right in the exception --> So whenever there's an issue then it can be able to end the handle errors, right? And then it also has --> features like connection pooling connection pooling and --> Betching for efficient communication. So a connection pooling is where you open a number of connections to be able to have parallel --> connections and be able to sort of --> Process some tasks in parallel, right? --> So how do drivers and this and the show with the work with the shell or the mongodb, right? --> So firstly, there's the communication protocol right way what the drivers in the mongo shell --> communicate with the mongodb using --> Okay, what happened to my sharing now? --> Did someone take over the screen because the sharing just stopped --> Can you see my screen? No. Yes. Okay, cool --> so, um, I --> Was talking about drivers and show communication with mongodb. So what happens is --> You've got the drivers and the mongo shell right and of which they communicate with the mongodb using what you call a mongodb --> wire protocol, right which is a it's a binary protocol basically that --> Defines how the messages are structured and transmitted between --> the to the client --> Which is the driver or shell and the service right and then also there's the part where the that there's the data --> Exchanged in bson format, right --> it comes in as --> Whatever language it is. It's --> Binary encoded serialized into Jason like documents --> Which is bson goes into the safe bit into the mongodb server. It's processed and then taken back as --> Plain JSON for example, right and then there's a connection to the mongodb way --> The driver is responsible for that connection. So it establishes that connection between --> the client and the mongodb server, right it also --> Does the managing of the connection pools, right? --> And then you've got the shell which is the mongodb shell which is the mongos h --> Which then connects to the server using a similar connection string, you know --> And then the drivers in itself using the drivers API can be able to send commands to mongodb --> So in Python, for example --> DB --> DB dot collection dot find to query document --> So you can actually write your query like that the API of the driver can be able to actually send that to --> to the mongodb server and then --> In regards to the shell you type commands directly into the shell. So it's the same way that you be able to do --> So it differs with --> With programming languages --> So for example in Python you use DB dot collection dot find in Java --> You just use collection dot find but they both interpret to the shell --> To the shell part being DB dot collection dot find right and then at the at the other end --> It also receives the responses. So --> responses that come back --> MongoDB --> Uses bson format, right? --> so it sends back in bson format what the drivers do is they then take that bson format and then --> Convert it to the data structure for the programming language, right? --> For example, it could be a JSON or it could be a dictionary in Python or it could be an object, right? --> they --> able to --> Then convert the data right usually the most used I think the most easiest and used --> Response in most languages would be JSON, right? --> And then it also does error handling as we spoke about it if errors, okay --> Let's say there's a network issue or there's an error message back to the client --> it's able to actually could better be able to showcase that this is the error and --> You can then do some troubleshooting --> Now let's talk about the binary --> JSON right binary JSON, which is bson which is binary JSON is --> binary code of serialization of JSON like document --> So when you see it, it's like a JSON document JSON a document, right the structure in itself is like a JSON anyway, right? --> The bson part of it is designed to be more efficient for storage and network transmission, right? --> Which means that it's it's compressed. It's a bit smaller in terms of --> What you call this the size of it, right and then --> Bison also extends that by adding, you know, your additional data types your dates your binary data and all that stuff, right? --> And why did the MongoDB choose this specific one bson bson is more compact --> You know, it's way more compact and faster to pass than a JSON, right? --> Which means it's smaller and easier to process --> Quicker to process and then it's got rich data types --> your --> Date your binary data your object ID 32 and 64 bit integers, you know and decimals --> 128 right and it's also compatible anyway with --> MongoDB because it stores data in bson format, right and --> It ensures that there is that seamless communication between the database and the applications --> Right and how does it how does bson work in MongoDB, right when you insert a --> Document for example, right the driver converts it from the language native format --> Which is obviously the Python or the Java into bson --> And then that's when it will be able to be processed, right? --> And then when you query the data --> MongoDB then returns the results in a bson and then the driver converts it back into the languages --> Native format, right and then we've got the MongoDB MongoDB wire protocol --> Which is a protocol that defines how the clients communicate to the MongoDB, right with the MongoDB server, right and --> It specifies the format of the message is send so including the query request --> Instead of data delete commands, what is it that you're going to be doing? --> What is it that you're getting back the results that you're getting back from the server, right? And it's a protocol --> That is designed to be lightweight and efficient, right? --> It's lightweight. It's efficient and it makes it suitable for high-performance application because it's lightweight and efficient --> It's very quick in its processing --> You know and some key features of that wire protocol obviously is the binary format way --> Messages are transmitted in binary and it is faster to pass and more compact, right? --> And then --> If the client sends a request which is a p and it gets it sends back --> A response right and then it's got this support for bson --> Where you can be able to have a bson format it then is able to actually assist in --> Connecting with the drive and all that stuff and then it also does --> Connection handling where it supports your connection pulling you keep alive to improve performance and all that stuff --> All right some key differences between --> bson and the wire protocol --> The purpose bson is for data format for storage and transmission --> And then the mongoDB is obvious if the wire protocol is for communication protocol between client and server and --> then --> bson is binary encoded --> JSON like documents and then the wire protocol is binary messages --> With the headers and payloads, right and then usage you used to represent documents in mongoDB --> And then the wire protocol is used to send and receive messages --> Between client and server and then some data types it bson supports --> Your date object id binary data and all that stuff and then the wire protocol --> Defines how operations and the responses are structured --> Any questions on that? --> No, no question --> All right, cool --> um --> Let's talk about some troubleshooting right your application connections --> um --> So sort of some things that you need to look at right? --> Let's say there's an incorrect --> The error is an incorrect --> Connection string, right? It might fail because of that, right? --> Your url might be missing some required parameters you need to check your typos or you could be using --> um incorrect credentials, right if there's a network issue then --> Uh, for example application might not be able to reach the mongoDB, right? --> You need to check things like your file any dns any ip any host name if there was any --> Error in regards to that and then authentication failures, right? It could be an incorrect username or password --> um --> um --> Or some missing or incorrect authentication, um database which is on the mongoDB side or --> User might not have the required permissions. For example, I remember yesterday --> There was a user when we had admin we couldn't create something --> Um after creating it so that could be another issue --> And then mongoDB server not running so the service in itself the server itself might not be running --> so, uh, you might want to check if it's down or it's properly configured to be able to accept connections and then --> There could be a drive or library issue. It's either it's incompatible or it's outdated --> um and um --> What you call this or there could be missing dependencies or incorrect driver configuration --> These are things that you need to be able to look at and then there also might be resource limitations where there is heavy load --> Or have reached its connection limit. It's things that you can also be able to look at and then --> TLS and SSL misconfiguration this one can be a very big one because it can bring your whole system down --> When you when you don't configure your certificates properly, you know, uh, it's it's a very very --> Big one anything that involves SSL if it's not configured properly then it can be a big issue --> Now let's talk about some scaling right? We want to scale some write and uh read and write --> uh scaling right and --> of which --> Scaling is obviously being is the ability for a system to be able to handle increased load, right? --> um and --> MongoDB has two main ones, right? --> There's the vertical one and the horizontal the vertical one is more or less increasing the capacity of a single server --> Right, so you're adding more cpu or ram or storage --> um --> And then some use cases obviously suitable for more small medium workloads --> Uh, the only limitation is hardware constraints, right? --> If you don't have enough hardware, then there's that limited constraint and then there's the horizontal scaling --> Which is the distributing the load across multiple servers, right in as much as yes the limitation is also --> Um the hardware that you have but also if you can convert that into virtual servers and all that stuff it could assist --> And this is usually ideal for --> Large scale applications right that have got a very high read and write demand, right? --> Um, and how does mongoDB achieve this when it's horizontal scaling? --> There's what you call sharding sharding is more or less splitting data across multiple servers, right to distribute the load and --> shards is --> Be putting them in small chunks, right? --> And then there's also replication where you maintain multiple copies of data --> To improve read --> Scalability and fault tolerance --> Right. Now, let's look at replication replication is where you've got data the same data across multiple servers --> Right and you ensure that there is that higher availability and fault tolerance --> And if the primary replica goes down a second replica can kick in and it wouldn't have any issue --> Because it's updated. It's got all well, we are saying theoretically --> We are saying that everything will be up to date, right? --> There is no technical issue that could be happening and all that stuff, right? --> And what is replication is is where there's a group of mongoDB instances that maintain the same data, right? --> There's the primary node which all handles your --> Read your all your write operations and replicate that across to the secondary nodes --> And then there's the secondary node which handles the read, right? --> It can handle the read operations and this is where your replicate replicated data is stored --> Right, and then you've got a lab bit away an arbiter. Sorry way --> This is an option optional one as you spoke the last time that it's a lightweight member that participates in election --> but doesn't store data its purpose is just to um be able to determine um --> Which one is the primary node today, you know, it's an option. It's an optional one. So --> Getting to how replication works. The first thing is there's the write operation --> So all write operations go to the primary node, right? --> It records the changes in its oplog operation log and then the secondary nodes --> Um asynchronously replicate the oplog and apply the changes to their own data --> Right, and then what then happens is when the read open read, um operations happen --> Reads are directed to the primary node, but you can also configure to say --> Um, let the read happen on a secondary node, for example any of the secondary nodes, right so that it improves --> um --> the operations you leave the right operations to just --> um the --> Primary node and you have the secondary node being the read ones --> Um, and then benefits of replication right high availability --> so --> Obviously when primary node fails it automatically switches to the next one, um by election process --> Um, which would obviously be one of the secondary ones and then it becomes the primary --> And then secondary nodes can handle read operations, right? --> So reducing the load on the primary and then data durability. There's that multiple copies of data --> That is ensured so even if you've one server fails you still have a copy of uh, what you call this --> um --> Of the data in another server --> right --> Let's go on to durability. Um durability way --> It ensures that once a write operation is acknowledged, right? --> The data is safely stored and won't be lost --> Right even in the case of a failure --> So how does mongo db do that? So --> There's what you call a write concern, right? --> The write concern specifies the level of acknowledgement required for a write operation, right? --> So for example, if it's one it's acknowledged by the primary node, which is the default --> There is majority which is acknowledged by majority of nodes --> in the replica set --> or --> Two --> Is got it says acknowledged by at least two nodes --> so at least two nodes to be able to confirm that they've written the same data --> and --> They've written the same data and then it will be like, okay --> This is fine now, right and higher write concern levels increase durability. So the more the higher you put it the more --> um --> uh, there's that durability but also be mindful of performance because --> If you've got a hundred servers that need to be written and you need acknowledgement from 50 --> It might take time as compared if you just need acknowledgement from let's say five servers --> And then it's confirmed as good then, you know that at least to be quick, you know --> And then there's journaling journaling is where um --> Your mongo db uses a write ahead log, right to ensure --> Um data durability and then before applying any changes to the data file --> Mongo db writes them to a journal --> It's like just writing in a in a in a diary or something, right? --> And then in case of a class the journal can be used to recover data --> so you can be able to use that journal to be able to recover your data because you --> Just go into your journal and be able to um --> Recover that data. It's very very recommended to have journaling in place --> Uh, because that way if there's a situation you can be able to recover to the last --> Available data, right? And then there's replication. Um where um --> You replicate, uh, obviously data to the different nodes, but there are some trade-offs, right? --> Where there's performance versus durability high durability, which is more or less --> Let's say majority can slow down your write operation --> Right because there is increased number of acknowledgement that is required --> Right and so you need to be careful --> You need to have that trade-off and then the configuration wise you need to choose the right balance --> Based on your application requirements. So you need to have that sort of --> Um, you need to look at okay. What is it exactly that? --> Works for us. Should I just have small number should I have majority of acknowledgement and all that stuff? --> Right --> Then you can be able to combine scalability replication and durability, right? --> So you can have read scalability, for example using your secondary nodes to be able to --> For for your read right that way you distribute your read --> um --> Um to your secondary nodes and then you configure read preferences, right? --> uh to your --> um --> To direct configure read preferences to direct reads to secondary, right? So primary you're left with just the rights, right? --> Leave it don't use that as the read although it is by default --> But direct all the reads to go to the secondaries and then you can also be able to direct it to the nearest --> So you can direct it to the node the lowest network latency available. That's another way of --> um --> Doing read scalability and then write scalability use sharding to distribute your rights --> um --> Across multiple shards, right? And each shard can be a replica set combining horizontal scaling with replication --> So you can be able to combine both and then durability wise you can then use your --> right content in journaling so that you --> um ensure data is safely stored and then --> Replication also provides that additional layer --> Um of durability by maintaining multiple copies of data so you can actually incorporate all these --> um --> Uh, what's called all these uh three and be able to have quite uh, um --> optimized --> System some best practices to it --> Uh use replica sets always deploy mongo db with the replica set --> Right that way it helps in higher availability and for tolerance --> And then monitor performance --> Uh tools like mongo db atlas or mongo stat can help you to monitor your read write performances --> And also external tools that you can use your promethias your grafana and then optimize sharding choose a shard key --> That distributes data evenly across hot spots --> To and avoid sorry and avoid hotspots. So avoiding hotspots is --> Avoiding just one shard being the one that's fed the data, right? --> So you spread them evenly and then regularly test your replica sets fail over sit off one replica and see what happens --> You know --> And then balance durability choose the right the right concern --> And journaling settings based on your application needs questions before we go to the next one --> No question from my side. All right, Winnie. Are you there? Yes. I'm here. No questions from me. Thank you --> All right, cool --> Let's talk about master slave replication, right? --> It's now legacy. Um, so you find that there is probably some --> um --> What you call the some --> Um organization that still have the legacy mongo db. Uh, it's outdated but you're gonna speak about it --> it's more or less like um --> Um, then your normal replication is just that um, it's it's now legacy, right? --> So you've got your master and your slave your master node handling or write operations --> And it's the primary source of truth and you've got the slave node which replicates data from master --> And can be able to read um operations, right? --> Some characteristics of it one-way replication. So data flows only from the master to the slaves --> No automatic fail over if master fell over then you have to have a manual intervention --> to be able to promote a slave to a master and then --> Limited scalability --> Only the master can handle rights which can become a bottleneck, right? --> How does it work? --> Write operations all insert updates and deletes are sent to the master nodes and then the master --> records the changes in the oplog the operation log and then --> Slave nodes asynchronously pull the changes from the master's oplog right and apply them to their own data --> Right and then the read operations by default reads are directed to the master nodes, but also you can be able to --> uh configure slaves --> To handle read operations which improves read scalability. There is a very thin line between master slave --> Replication and the replica sets right and then so why master slave replication is depleted --> So there's there were some limitations to it, right? --> um --> In favor of replica sets, so no automatic failover, which is a very big one --> If there's an issue then you go have to --> promote --> The slave into master, but now we're talking about downtime at that time --> Uh loss of data at the time right limited for tolerance, right only one master exists --> So which is a single point of failure and then you've got no built-in election --> So for example the arbiter you can be able to use the arbiter to --> Do the election of a new primary right in the replica sets --> But with this and it doesn't have and then there is no support for modern features your arbiters your priority setting your right concern --> which then --> Makes it uh deprecated --> All right, but some best practices when you have that legacy system is monitor the master node --> It's the most important one you need to make sure that you're monitoring its health and performance --> Um, and then configure slave nodes for read scaling --> Right configure that your reading goals your read operations go to the slave --> So that you lessen the load on the master and then plan for manual failover --> You have a documented process --> You know for promoting slave to master in case of a failure and then backup data regularly using your mongo dam --> Your file system snapshots and all that stuff and then --> Upgrades to replica as soon as possible as when you can --> Right, you can be able to do that migration from master to master slave replication to replica sets --> and then replica sets obviously have the advantage of --> Automatic failover better for tolerance. There's some some modern features --> So how then do you do your migrating from master slave to replica sets? --> The very first thing is stop rights to the master, right? Uh temporarily stop your right operations to the master node --> Add slave nodes to the replica set. So you restart the master and slaves as part of a replica set --> and then initialize your replica sets, right you connect to the master node and run the --> uh replica set --> initiate command and then you add the slave nodes using the replica --> Replicaset dot ed or rs dot ed command and then simulate a failure of --> the primary node and ensure the secondary is --> Automatically promoted and then update your application configuration or connection strings, right? --> To be able to point at that replica set. Is anyone familiar with kubernetes? --> Uh, not much on my side, but yeah, it's something that i'm interested in --> Mm-hmm. It's yeah, it's a very interesting one because I know it's about micros. Uh, so it's credentialed microservices --> Basically, it's uh instead of using the traditional --> uh dedicated host or server they need to --> have uh --> Containers yes containers --> Uh and portion your your your microservices or your applications. Yeah, definitely --> It's a very good tool out advice --> Anyone to look into it companies to look into it because it helps a lot in terms of --> High availability scaling because there is that automated scaling that happened --> You you also break your system into into smaller chunks. So you have a situation where if --> If people can't log in it means it doesn't mean that somebody that's logged in already has issues --> It would just be the logging in that's the problem --> So you just need to fix that the rest will still be up and running, you know, as an example, which is very very good --> That's another that's another technology where replica sets are used. So in essence --> You would say your replica set in kubernetes. You want to have a minimum of four containers that are --> That represents log in log in right your authentication --> So you tell kubernetes that I want a minimum of four. I want a maximum of ten, right? --> So automatically when there is pressure on the logging in it increases the number of replicas, right according to --> um, obviously what you would have set in terms of usage, let's say --> um --> CPU usage for example average cpu usage when it gets to 70 then create another replica --> That's another technology that uses the replica sets in a in a way that replica sets should be used --> So it's worth looking at --> Um, so what is a replica set? Uh, obviously mongo db is a group of mongo db instances that maintain the same data --> Uh, it helps in terms of high availability where you've got the automatic failover --> Some data redundancy where you've got multiple copies of data across different servers --> And then uh read scalability, um the way you've got secondary nodes where that can handle --> um, uh what you call this that can handle read operations --> And then some key components of a replica set. You've got the primary node obviously handling all the right operations --> does the --> Does the recording of changes in the operation log and then replicates data to the secondary nodes? --> Then you've got the secondary nodes which replicate data from the primary can handle read operations if you configure that and then --> um, it can participate in elections to select a new primary if the current primary fails --> And then you've got an arbiter which does the election --> But it doesn't store data --> Um, and then you've got the oplog the oplog which is a kept collection that records all right operations --> So anything that's written is logged into that and then used by secondary nodes to replicate data --> All right, how do upper replicas work? --> replica sets work --> Um, firstly, all right operations go to the primary nodes the primary node record the changes into the oplog --> And then there's the data replication where asynchronously secondary nodes pull the changes from the primary's oplog and apply them to their own data --> and then --> This ensures all nodes in the replica set of the same data and then the read operations by default --> Read is directed to the primary node, but it you can then configure read preferences to be distributed --> Uh to the secondary nodes, right and then you've got automatic failover if a primary node falls --> Fails an automatic election --> process happens right and then a new primary for --> the secondary nodes then is --> then um --> promoted right and --> Factors that it's based on it could be priority --> It could be not held. It could be 14. So those are some of the ways that it can be able to do that. So --> a replica set configuration --> Um, for example your replica set should have members. So there's host --> uh --> Worst one which is mongo mongo one priority two mongo two is priority one --> And then mongo three is the arbiter right so it doesn't their mongo three doesn't store anything --> It just helps in terms of the voting process of making --> the what you call this --> Between one and two making it the primary in case there's a there's a situation, right? --> And I idea id is the name of the replica set and then you've got members --> Uh an array of nodes in the replica set and then priority in the likelihood of a node becoming --> uh --> Primarily the higher values goes to higher priority and obviously the arbiter only marks the node as an arbiter --> And that one does the voting --> Some best practices to replica sets, um use an odd number of nodes, right? --> Always the plain odd number of nodes three five --> Uh, so that you have proper elections, I don't and i've never got to understand this, um way of doing things off --> Uh, what you call this deploying odd numbers of nodes, right? --> But if you have an even number of nodes using arbiter to break ties, right? --> And then distribute nodes geographically deploy nodes in different data centers or regions to improve for tolerance --> but considering that also you need to --> Um look at the networking between um --> What you call this networking between those and then use priority settings to control which nodes can become primary --> um --> configure --> Read preferences so use read preferences to distribute read operations, right? --> Primarily obviously default but also use secondary all reads --> send all reads to the secondary or --> Send all reads to the nearest right, uh with the lowest network latency --> Then monitor replication lag. It's very very much important --> MongoDB atlas or rs status, which is replica set status to monitor replication lag --> And then ensure secondaries are keeping up with the primary to avoid stale reads --> Enable authentication when it comes to replication use key file authentication or --> 509 certificates to secure communication between nodes, right? --> Um ensure only authorized nodes can be able to join the replica set, right? --> Test fail over regularly. It's very very much important simulate and not failure --> And then use your ris step down command to manually step down the primary for testing --> Use right concern as we spoke about it where one is acknowledged by the primary default majority acknowledged by majority of nodes --> And then two acknowledged by at least two nodes, right? --> Always back up your data --> Always make sure that you back up your data regularly and then upgrade to the latest version --> um as always to uh --> To take advantage of the latest features and bug fixes, right just a summary about it --> Um replica sets obviously provide high availability some fault tolerance data redundancy mongo db --> And then there is the consistency of the primary node secondary nodes and abita --> And then best practice is using odd number for nodes and distribute distributing nodes geographically --> Um configuring read preferences and testing failover regularly and then replica sets are critical --> component of mongo db architecture because then it helps --> In overall performance, um, and when you configure them you need to be --> You need to configure them and manage them carefully to be able to ensure optimal performance and read liability --> Now some right concern, right let's talk about some right concern any questions on replicas --> um --> no question --> maybe just uh --> Yeah, I think this might be a question so --> With databases the --> When you talk about replication and that concept of active active active --> standby active --> something --> So in this case, um, do they have such a setup where you can run active active active standby and so --> Um in this setup when it comes to replica sets, they are all active the functionality is um --> What differs so your primary done the writing so your inserts your update, right? --> and then your your your um --> Your replicas right your secondary nodes do the reading you can configure to do the reading --> So they are all active in essence the functionality is what's different --> So in this case you can have um --> You have five active servers the functionality is what differs right? There's that --> That that one where it's um, it's that situation. We've got a whole lot of replicas and one --> Uh primary and many secondary then you can have a situation where you've got active and um --> Inactive so you've got the active one which you're doing everything basically the read the write, right? --> And then you've got one secondary node probably that's just there for replication purposes --> You're not doing any read or any write on it, right? --> Then you have that active and non-active type of type of setup but with replicas, right? --> Normally with replicas, they are all active. The difference is --> Uh the functionality the primary nodes does the right and then you can configure this the other secondary nodes to --> Actually be the ones to do the read --> Okay, so but then the --> The the switch over is it seamless like --> It doesn't need manual intervention it when it comes to replicas. Yes, the switchover is automatic --> Okay, so it will promote --> What was the secondary to become the primary to become the primary? Yes --> So if it's got many right if you've got many secondary nodes, there's the election part --> There's the priority part, right? So it could be done. Um --> Uh what you call those? --> Through the election part where the arbiter does the election to say okay --> This one is closer to the primary and it's a health --> It's very healthy network latency is very good in terms of it and the application --> This is based on let's say geographical location --> So then it will elect that one or it will elect based on priority. Which one is the highest priority? --> You know if it's priority one, then we're going to elect priority one --> For example, but it's automatic the failover is automatic --> Oh, okay. Yeah --> Thanks --> No, okay some right concern. Um --> Uh where we sit we are sort of set it's a setting that determines how mongo db acknowledges your right operation --> So you insert your updates your deletes, right? --> Um, it specifies how many nodes must acknowledge the right --> it then --> Um specifies whether the right must be journaled --> Right written on the disk journal, which is very much recommended and then by configuring this right concern --> You ensure that the data is safely stored and replicated across nodes, right? --> Why is it important? There's durability you ensure that the data is not lost in case of a failure, right? --> You make sure that it's only written when it's acknowledged by other nodes, right? --> There's consistent so you're guaranteed that the data is replicated to the required number of nodes --> And then there's the performance trade-offs right way higher levels to the right concern increased durability, but may affect right performance --> So you need to be mindful of that sort --> The right level the right concern levels, right? There is the --> Zero unacknowledged. So just right --> You know, I don't um, uh, you don't need to acknowledge anything right? --> Um where these are in situations where it's just the right and forget scenarios, right? --> Performance is critical data loss is acceptable, right? --> I wouldn't know what situation where data loss is acceptable. Um, but --> Yeah, you can have that situation and then acknowledge one which means primer not just --> Needs to acknowledge right? So general your general purpose applications --> Uh, you can be able to do that. Um --> Uh, and then when you have majority now we are saying --> Majority of the servers right of the replica set if you've got 10 replicas --> Majority of them 60 to 70 percent 75 percent of them should acknowledge to have written the data, right? --> which --> Can cause --> Uh issues, right? Um in regards to uh all this. Uh, let me just pick up a call one second --> It's an important call --> Hello, hi --> Okay, i'm back so that's your majority and then --> Um, you've got a situation where you can write the specified number of nodes to acknowledge --> So in essence if you want four to acknowledge out of the 20 or you want five to acknowledge out of the 20 --> um --> Then you can be able to give that and then --> You also need to have journal right being active being true. So --> Uh journal being true is the j true. Um --> This would be obviously right is acknowledged only after it is returned to the --> to the on-desk journal, right that way there's --> Surety that data durability it ensures that data durability even in the case of a server crash, right? --> and then --> Um, you've got your time out which in essence means that if there is a time out if the --> It gives us time limit to the right operation to complete right if the timeout is reached then the operation --> It returns an error. So it's your right time out, right? For example in this case --> um --> It's in set one right concern should be --> Uh should be acknowledged by two, but if there is a timeout of five thousand seconds then um milliseconds then --> seconds actually then um --> It should give an error --> So how does right concern work client sends right operation, right? --> Whether it's the application whether it's the user or whatever and then primary nodes process the right --> So which means the primary node applies the right to its data set and if j is specified it also writes --> um --> The the right is also written to the journal and then the primary nodes replicate the secondary --> Nodes, right? --> If then there are 10 that needs to acknowledge it then acknowledges that and then only after that --> Only after it gets that acknowledgement then the right is actually --> um what you call this the right is actually --> Acknowledged and then um sends a response to a client some best practices towards it --> Uh, choose the right right concern, right? Um one for general purpose application majority for high durability requirements or --> Zero for non-critical data that you don't really need to um keep --> You know, um enable journaling. It's very very much important set a reasonable time out --> And then monitor right performances. You need to monitor that and then test fail over scenarios --> And then use right concern with replica sets. It's very very much good --> um when you use the combination of two --> now, um --> some --> replication failures --> um --> What are these replication failures? So replication failures can okay when the secondary nodes are able to replicate from the primary node and --> Which could lead to data inconsistencies? --> Uh loss of high availability because now you can't automatically switch over --> And even --> If the primary fails, right the second that is not up to date to even take over right and then application may experience --> Errors or degraded performances, right and then some common causes of uh replication failures --> Could be network issue between the servers right the nodes in themselves, right? --> Uh, it could be high latency or some packet loss. Also could be hardware failures. It could be a disk failure --> You know, um --> Server crashes or power outages could be another issue and then configuration errors --> um --> incorrect replica --> uh set configuration and also um and also mismatched mongo db uh versions of um --> Mismatched mongo db versions or configurations and then some resource constraints could be insufficient cpu --> Memory or disk i or you know, um high high write a throughput causing, um, --> uh --> Replication lag and then some oplog issues, right? --> Let's say the oplog on the primary node is too small which can cause it to override old entries before --> Secondaries can replicate them and then some data corruption --> You know that's a corruption of the corruption of data files on the primary or secondary nodes --> Could be another issue --> some diagnosis to um to that --> Check replica status rs.Status is very much important. Look for the state of each node the primary the secondary --> uh recovering etc --> uh replication lag opt uptime --> Date and last heartbeat fields can be able to tell you that and then some error messages or warning --> And then monitor your replication lag also rs the print secondary replication info to be able to check replication lag --> Your high leg indicates that secondaries are failing behind the prime falling behind the primary. So you need to --> uh probably restart --> um --> um --> Your your your replica set so that it catches up or you need to --> Stop the application from writing until they catch up. It just depends what you do --> It's never advised to stop the application anyway, you know, and then check mongo db logs --> You need to examine your mongo d.log for any errors or warnings in relation to replication --> um --> These messages like your replication is too far behind or cannot replicate because oplog is full --> You need to be able to look for that --> Um, and then verify network connectivity, right? Um pin --> um --> between nodes --> Your files or your security groups allow --> traffic on mongo db make sure that they're open --> um, they are okay and then check disk and resource usage your --> Disk space usage your cpu your memory usage on all nodes and then also your tools like your --> mongo start mongo top can help you in terms of --> identifying resource, um --> Obviously when there's a network issue resolve some connectivity between the nodes, uh resolve any other issues if you need to make any changes --> Um adjust oplog size oplog size is is very important --> You need to be mindful of that after you increase that you restart the primary node --> And then re-sync affected secondaries and then um reconfigure replica set if you want --> Ensure that it's configured properly using the --> Uh rs.conf --> Uh to view the configuration update anything using the rs and reconfig if needed --> then upgrade your mongo db to the latest version but --> The stable version not just the latest version --> But the stable version and then monitor and optimize performance optimize your queries --> Use indexes to reduce write throughput scale up hardware resources if necessary --> Write some how to prevent replication failures --> Use odd number of nodes, right? --> Because then there's proper election and fault tolerance --> and then monitor, uh replication lag --> Regularly backup, uh your data test failovers regularly use right concern --> To ensure that --> data is replicated --> Uh to multiple nodes and then keep your mongo db updated --> Questions on replicas i'm so good --> Where is akona today and ito they are too quiet --> Oh, we are listening oh we are listening --> Okay --> Okay --> Now let's talk about sharding sharding is the mechanism of distributing data across multiple servers which are called shards, right? --> uh where you then achieve that, um --> Horizontal scaling right it automatically manages data distribution across shards --> Query routing to the appropriate shards and then balancing data evenly across shards --> Right. Why use sharding? --> It handles large data sets and high read write throughput, right? --> There's that scalability --> And then performance wise it distributes load across multiple servers --> And then it can store more data than a single server can handle --> Right, how do they work? So the key components of it is a shard so --> And each shard is a replica set or a standalone mongo db instance where it stores a subset of data, right? --> um --> For an example's purposes shard one stores data users a to m shard two then stores n to z, right? --> It's also got a config server where --> Metadata is stored about the cluster including the mapping of the data to the shards, right? --> Must be deployed as a replica set for higher availability --> And then it's also got what you call query routers --> Obviously that sort of interface that acts as an interface between the application and the shard cluster, right? --> Trout queries to the appropriate shard based on the shared key on the shard key --> And then what is a shard key a shard key is more or less a field or a set of fields used to distribute --> um --> Uh what you call this used to distribute --> um --> Data across shards, right? --> So if let's say your shard key is a user id which means mongo db access the user id value to determine which --> Shard should store the document, right? --> And then there's also that data distribution where it's a range based or hashed shedding. Um --> um strategy to distribute the data so when it's a range based --> Data is divided into ranges based on the shared key, right is is the example above the a to m and n to z --> and then um hashed shedding is data is distributed using a hash of the shared key, right? --> Then there's also the part of query routing where when a query is sent to the cluster, right? --> The mongo s router determines which shards contain the relevant data --> And then the query is routed to the appropriate shard, right and the results are combined and returned to the client --> and then --> Does what you call balancing there's what you call a balancer that --> Automatically balances data across --> um --> Across the shards and then this balancer moves chunks subsets of data between shards to ensure even distribution --> All right, how do you then set up a shard cluster, right first you set up the config server --> So you deploy a replica set for the config server --> For example there in blue. You've got sharding cluster role is the config server and then the replication --> uh replication set name is configure replica set --> config being the config server replica set and then you set up shards so you deploy replica sets for each shard and then --> An example is uh, you call cluster role is the shard server, right? --> And then replication you name it shard one replica set --> And then you can be able to add replicas to a replica set, right? --> Uh, so you start your query routers start mongo s instances --> And configure them to connect automatically for examples purposes mongo s configure db the config set --> Um configure replica set, uh config one and then config two and then config three as you go --> Which is more or less. This is you connecting your configuration replica and then you add shards --> To the cluster. All right, so --> Connect to mongo s instance and add shards to the cluster. For example --> add shards sh dot s shard --> Shard one replica set --> Uh shard one a shard one b shard one c and they connect using that port --> And then shard two replica sets shard two a shard two b. This is how you can be able to add those --> shards to --> the cluster, right and then enable sharding for a database where um --> You enable sharding my database to a specific database and then you can be able to shard the collection --> So you can also shard the collection, right? --> Where you've got shard collection and then my database dot my collection user id one --> And then some best practices for sharding --> You need to choose the right shard key. You need to --> um have a high cardinality many unique values type of key and then --> Distribute rights evenly across across shards and then also support your most common queens --> So your your key should be able to support your most common queens --> um, as I gave an example when you get into the bank the very first thing they ask you is your --> Your your id your id will be able to pull everything so things like that --> You can be able to have it as a shard key, right? --> And then monitor and balance the cluster if you use things like mongo db atlas or --> sh status right shard status --> You can then be able to monitor your cluster and then ensure the balancer is running and that is evenly distributed --> Use hard hashed sharding for even distribution, right and um --> Your shared key is low cardinality or is monotonically increasing --> so --> Use hashed sharding to distribute data more evenly and then avoid hotspots and the hotspots is an even distribution of rights --> And plan for growth plan that you are going to add more shards --> Um, or because there's going to be add there's going to be more data coming through --> You probably need to add more shards and then back up and secure your cluster and then test before production --> It's very much important --> How do you choose a shard key, right? It's a very critical component of it, right and --> Shard key as we said is a field or a set of fields in a document that mongo db uses --> To distribute data across shards, right? You could use user id and then when you select user id --> Then it's going to use the user id value to determine which shard should store the document. So if you've got --> 10 shards --> And your user id is incremental then it will be able to determine where to place --> Um, which document some characteristics of a good shard is high cardinality --> So it should have unique values, right? --> Unique values to ensure that there's that even distribution an example being user id because um --> It has many unique values, right? --> Even distribution if the shard key should distribute rights and reads evenly across shards, right? --> It avoids keys that create hotspots and then query support so it's able to assist with queries --> Um, and then for example if most queries filter by region use region as part of the shared key --> Right the shard key --> Immutable, right? It cannot be changed after shutting a collection. So you can't change that after shutting a collection --> So you need to choose a field that will not change over time. That's very very --> Uh important to the system and then some type of shard keys. We've got single --> Field shard key, for example user id --> Right, uh simple and then this compound one which is region one and user id --> Where you provide like a compound --> Uh shard keys like a compound indexing and then there's the hashed --> Shard key where you hash. Um --> um --> What you call this you hash the --> the user id --> Right and then uh choose an example for a collection of user data --> You can use user id and then for a collection of orders you can then compound --> uh --> Shard key, right? --> Could be order date region. It could be user whatever right and then sharding and indexes play a very --> Uh critical role, right? --> In optimizing queries now shard key shard key index, right? --> So mongo db also requires an index on the shard key, right? You can actually index that if no index exists --> mongo db creates one automatically when you shard the collection --> So it's --> It's that type of scenario where it says I really need --> This shard key to be indexed if you don't index it i'll index it on my own --> and then if you're using compound shard key ensure the index matches the shard key so --> Like previously I did email and age right as indexes then I need to make sure that my --> um --> my shard key also, uh --> email and --> Age right it helps a lot and then it helps in terms of query performances --> Um queries that include the shard key are added to specific shards --> So which is very good for performance and queries that do not include --> The shard key are broadcast to all shards which can make it slower, right? --> The same way with index when data doesn't have an index or when you don't have an index --> It needs to go through a whole collection when it's got an index --> Then it just goes straight to the index and that's it --> All right, some best practices is create indexes on fields commonly used in queries the same way you use shards shards --> Use them use them --> Commonly the fields that are commonly used in queries and then or the data that's commonly requested or created and then --> Use covered queries queries that use only index fields to improve performance --> Then you've got sharding and replica set topologies, right? Um, they are often used together, right? --> Not often they are used together, right? --> There you've got scalability. You've got high availability. You've got improved performances, right? --> And you're going to also have shard as a replica set when I was showing --> the um --> The configuration here, right? They actually had a replica set. It's got shard as a replica set, right? Um, so --> Um each shard in a sharded cluster is typically a replica set --> And this obviously ensures high availability and full tolerance for each shard --> and then when you have a config server as a replica set, it means that your --> Um metadata --> Um is distributed and that way --> um --> Config server that store metadata about the shard server must be deployed as a replica set for high availability, right? --> Is you've got that high availability --> Where when one crashes the primary crashes then you've got the secondary and then um, --> Also have query routers where mongo instances are stateless and can be deployed on multiple servers --> um for scalability and --> Uh redundant that's your mongo s and then an example of a topologies --> Having shards which are three replica sets shard one shard two shard three and you've got config --> Servers which is one replica set which has got three nodes and then you've got query routers, which is three mongo s instances --> Right. That's an example --> Topology that you can be able to have in place --> Now, how do you minister? --> administer um --> Sharded clusters, right? Firstly you monitor using your mongo db atlas, right? --> Um, you monitor you balance you optimize performances and the monitoring part you can use your mongo db atlas --> Uh or mongo stat to monitor the cluster. The key matrices to look out for there is your replication leg --> Um, is it falling behind and then your shared by your shard balancing? --> Is it balancing it right and then your query performances, right? --> Are they are they slow are the pretty performance the pretty performance slow, right? --> You also need to balance your cluster, right? --> Um using a balancer so you can disable the balance for for a collection --> You can also be able to start a balance manually. So for example, they --> Disable balancing for my collection. So your database name is university and your collection is students. You can disable that --> um, you can also manually start or stop the balancer and then you can also be able to add --> Or remove shards. So for example --> The shard replica set, um is shard replica set one --> Um, that's the name of the replica set and then you want to add the host and port --> So you want to add the new host or you want to remove a host, right? So you can have that --> sh shard dot sh dot remove shard and then um --> The name of the replica set and then the host that you want to remove, right? It's also important to do --> Uh some baking up and restoring are very much important and then enable --> authentication and encryption --> Uh to secure your cluster use role-based access control and then upgrade your cluster --> It's very much important --> So but you need to follow the mongo db upgrade instructions to upgrade your shared cluster --> It's very very much important and then ensure all components your shards your config servers and mongos --> Upgraded in correct order based on what mongo db would be --> Um instructing you to do --> Questions --> Anyone else no silence means we are good. Okay. Now let's talk about um --> Shard chunk migration so shard chunk migration is --> Uh a key feature of mongo db, right and it ensures that there's that --> Ensures that data is evenly distributed across --> Shards, right? What is a chunk a chunk is a subset of data, right in the shard collection --> And what mongo db does is it divides data into chunks based on the shard key? --> And each chunk is assigned to a specific shard, right? --> Um --> Why does chunk migration happen right for balancing purposes? --> For example, right between shards it wants to have that even distribution or when there's that manual intervention --> Um where administrators can actually move --> Chunks for maintenance or optimization. That's another reason why chunks can be migrated --> And how do chunks chunk migration work? How does it work? Right? There is the balancer the balancer --> Monitors the distribution of chunk across. Um chunks across shards, right the shed --> for shard --> Has significantly more chunks than the other the balancer initiates the chunk migration to one that you've got. Um --> That it needs to level up --> And then the migration process behind it is the source shard copies the chunk to the destination shard --> The destination shard applies any changes that occurred during the migration and then the config server updates the metadata to --> Reflect the new location of the chunk --> Right and then upon completion once the migration is completed the chunk is removed from the source shard --> So it makes sure that everything is good and it's updated in the --> In the config server and then it removes from the source --> Some backup and restore plans --> Um --> backup and restore plans, um --> Some backup strategies that are available --> File-based backup so you can take snapshots of your mongo db data files, right? --> and then --> Um, this one is suitable for large data sets with minimal downtime --> So you can use things like other sync or whatever or you can use --> um --> Snapshot kvm snapshot if you're using kvm and then you can do logical backups where you can use mongo --> dump --> Where you can export data in bison to json format. This one is suitable for smaller data sets --> Or specific concerns collections and then you can also have cloud-based backup right your mongo db atlas or other cloud services --> for automated backups --> and then --> restore strategies --> You can restore data from a file system snapshot. You can do logical restores --> So if you do mongo db, you can then do mongo restore to import that data and then restore data from cloud backups --> That's another option that you can be able to use some so some files based --> file system based strategies, right some steps to it. So for example taking a snapshot of --> uh mongo db data files --> So first thing you need to do is stop the mongo db instance or lock the database, right? --> Take a snapshot of the data using tools like your lvm, uh, your aws eb snapshots, you know --> Or whatever you're using and then after it's done you unlock the database, right? --> And then some steps, uh for file system based restore stop the mongo db instance --> Replace the data files with the snapshot and then start the mongo db instance. Be mindful that --> you need to place your data files in the --> Um the path that is configured within your mongo db config file, right? It's very much important --> Some best practices to it --> Obviously test regularly to ensure that they can be restored and then use journaling to ensure that the data --> Is consistent during backups --> Then when you also use mongo db and mongo mongo dump and mongo restore, right? --> Mongo dump being uh, for example there you've got mongo dump --> Your host is your local host the port and then the out backup --> I think we did this this yesterday and then you can just be replace the mongo dump --> Uh command with the mongo restore --> Same everything else stays the same is just from mongo db you change it to mongo restore --> And then some best practices to it use the oplog with --> mongo db --> Um mongo dump. Sorry to capture ongoing changes during the backup --> And then compress the backups to save space so you can use the dash dash jzip --> Right when you're using the dash dash when you're using the oplog --> It's a matter of just adding dash dash oplog onto it --> onto the command --> You can also be able to use arsync, right? --> Um arsync where you make copies of data files to a backup location --> It could be to a remote location or to another folder. For example, you can be able to use --> arsync and then --> Um best practices is using arsync with delete to remove the files in the destination that no longer exists in the source --> right, so --> Updating wise use the dash dash delete which then tells --> arsync to be able to get to the destination and be able to check if it's not from --> Um from the source, it's not if it's not available in the source then make sure it is deleted in the --> Destination also right some there's also mongo import and mongo export --> mongo export is where you export data from a collection --> To a json or csv file, right? --> So for example there you've got your mongo export dash dash host localhost port --> You are doing my database you could you could be university in our case --> And then your collection is students and then you are putting it in --> um --> In a backup folder and you're making it my collection dot json --> And then when you then need to import it's a matter of making sure that you just change from mongo export --> to mongo import and then --> More or less the rest of the stuff is the same. It will just do --> the reversal --> Any questions? --> That's for good mind. Okay, cool. Um, we probably going to --> finish the theory part and then we go into --> our tea break and then from our tea break we come and then --> Uh do the practicals then it will take us through the rest of the day --> So some best practices, um --> for the for your --> Backup and restore --> Use dash dash type to specify the file format and then use dash dash fields to spot specific field to export specific fields --> And then some some some summary to that --> Shard and chunk migration it ensures that even distribution of data across shards. You can use the balancer or you can --> um manually move chunks --> Um backup and restore plans you can use the file-based strategies. You can use the mongo dump mongo restore you could use --> um --> What you got this cloud-based backup and then you've got your mongo db --> mongo dump or mongo restore obviously for export and import data and then file based --> file system based strategies --> Taking snapshots of your mongo db data files for light sets --> And then you've got arsync also where you can synchronize mongo db --> Um data files for backups and then you can also use the mongo import and export, right? Um --> Exporting it into or importing it --> Exporting or importing in json or csv format obviously for specific collections --> It just depends. What is it that you want to be able to do? --> Now that's the theory part about today --> um any questions in terms of today and yesterday the theory part --> Before then we go into --> Um the practical part of it. Okay. Silent says we are good. Um, it's 21 past --> We can take now and be back at quarter two --> Um from our tea break and then we'll continue from number six on the practical practical stuff --> All right. Thanks. Happy with that --> Awesome stuff. All right cool. I'm gonna you can go and eat --> He's already good --> Yeah, correct --> So --> So --> I --> So are you saying I'm not saying people will just come to see me and --> And people will just come to see me. Yeah, we will just meet up and whatever happens happens --> Did you get me from that? Yeah, but i'm gonna put it like this, right? Where's the camera? --> I want to look at the camera --> I actually just want to make it clear that a lot of people actually think --> This is like prostitution and this is like no, but it's actually knowing the radio so you smash the cash. Yes --> But wait --> I'm a bit confused. I'll tell you why it's like --> Baby, I don't know the textbook definition --> So --> If you go to this website it can create a step-by-step guide with screenshots --> You can open google sheet or excel click on start capture in the second row type in equal sequence --> So we need one thousand rows one column start at one step --> Then hit enter. There we go --> Then click on complete capture now you have step-by-step guide of how to make a lock here's gpt hack that will change --> I'm sure you'll record what happened back in 2011. I had the entire state security --> Because we're seen as as a threat to the national security simply because there was a file on our desk --> About a very senior politician and as a result they deployed all the state resources to counter that --> That's why I was sitting at home --> So that was not surprised --> I gel with the rock animals in the organization, which they irritated some politicians --> And then i'm happy to say today some of the rock animals are dealing with in the police are not in the service anymore --> Some of them senior people are sitting in prison --> That we're dealing with back then in 2011 --> But when we're doing that we were handcuffed were the bad ones simple because we charged the wrong people --> So we do not surrender them. We're not going to surrender now --> So --> I'm not going to waste my bread and dealing with people that are faceless --> But for those that are within the system that are doing things around we're going to challenge them --> And deal with them, but if they want to come physical we'll find each other on the field. That's just about what it is --> Um, so we have another beautiful lady over here. Hi, what's your name? Hi, who are you i'm tasha cubes. Oh tasha cubes --> Nice to meet you --> um, so a couple of questions --> Um, so if we were to offer you a 10k eft or 500 e-wallet, what would you choose? --> What would you do with it --> Solo date guys --> Um, so we have another beautiful lady over here. Hi, I need your guys's help --> Did you know if you go to this website --> Try problems to separate your business dealings with your personal affairs --> If you're running a business or an emerging entrepreneur doing a startup --> Ensure that you separate your business matters to --> Our business matters don't mix up the expenses don't pay --> using --> the business money --> Make sure it's distinguishable between yourself and the legal entity which is your business --> We find this to be a problem amongst most of our clients that are having startups or they are running --> sole proprietorship --> Businesses where they are the sole trader and so forth and some of them we find them paying medical aid --> Using the company and they're paying for their parents and so forth which are not employees of the company --> and it becomes difficult then to --> comply with that --> a lot of them we find them to be non-compliant and --> We have to do vdps and then try to --> Help them with their compliance. So it's just an edge --> To most of to most taxpayers just to to keep that distinction clear guys --> It's --> 2025 --> We can't keep having the same conversation about video call etiquette --> You can't open your whatsapp or open your facetime app and type someone's name that you're not used to in that way --> That you don't have that relationship with maybe when that person talk like once or twice a month --> You type their name and you paste that little video button and call them without even giving them a heads up --> Something that's simple. That's just before you're gonna call to say are you free? Can you take a call? --> Can I video call you let me know when you can take a video call. Let me know you can take a call simple --> I look at my phone chain. I stay like my phone. I just stay at my phone like this because --> Why are you just with some of the funny moments he initiated in house? --> Is --> One of the politicians that is a popularity appeal across political spectrum his personality and him the title --> Just imagine how good --> You guys have a dated scammers --> Like because you're not like scammers like --> Hey guys, charlotte here with me and my family --> So my best friend kind of picked me up so she could drop me off at my brother's place because that's where my parents were meeting us --> Also, his suitcase was very close and then he's come with a new suitcase for him --> And I basically went into one car so I had to take two cars and no one doesn't trust my driving --> So I drove my dad and my brother drove his car and got to get boards and we had the support to help us --> And he was actually so rude he had to shout at us --> But anyways, we had to take the standard picture and then we got to the lounge and the food was a bit --> But I was happy and my precious little tequila --> Then we finally got onto the plane ready for our 11 and a half hour flight and there was so much to choose from --> I was just so overwhelmed, but I just ended up watching it ends with us and then had some dinner and this cocktail --> And then we landed in london and had to go find our connecting --> Flight and we had another eight hour flight ahead of us, but we were so excited and I was waiting for my son's flight --> So I watched harry potter had this cocktail. I had this charcuterie plate and it was too good and then guys my brain fell --> And I was just like so sad --> I watched french issue and had some bubbles and after playing for almost 20 hours, we finally made it and can you remember me? --> Hey guys --> Anyone --> So this is video number two number one --> Me --> I'm seeing a lot of people using cursor wrong anywhere like I cheated. Okay --> Because I've already forgiven cheating seven times --> Okay, are we back --> Oh --> Okay, cool, I just need to log into my machine quickly --> Um --> You guys see my screen --> Um --> Okay, cool. So --> Yesterday we did up until number five and then we did exercise day one --> so we can --> Uh, let's see --> Uh, what languages do you guys um understand best programming language? --> Um --> So this one has got some python, um, it's got some java --> Uh, it's also got some ruby --> Uh some php some pearl --> So it's just examples of how drivers work --> Um, and then also some debugging steps that might this might just be --> Some reading that you may need to do but number seven. Um --> Probably need to do that one --> Probably need to do that one because you're going to start three config servers --> And then you initialize the config replica set and then you create some shards --> And the difference with the shards when it's localhost is basically --> The folder that's going to be created on --> the server so you see shard one, uh, and then shard two and then --> Um initialize the replica sets based on port, which is obviously this port --> And then you can start the query. So number six --> Um, you can do it. It's just a simple one to showcase --> Uh the connecting but um number seven you need to do it because then it shows sharding --> And then um this one number eight, we also need to do it --> Um, you enable right scalability and all that stuff --> Um, you can be able to use the if you're clever enough --> You can use the shards from the other one or you can recreate --> New shards right that you can be able to um create here and then create a mask --> This is a master slave replication type of setup --> Um, and then you can be able to use your right concerns and all that stuff --> And then number nine is backup and restore --> And nothing much to it, but you set up your shard cluster --> You simulate chunk migration --> And then the chunk distribution you check your chunk distribution or you manually move the chunk distribution --> Uh, and then you do your backup and restore so you lock it first you do your other sync --> and then you um --> Unlock the database and then --> Yeah, it's more or less doing that. So six seven eight nine. Let's do them --> Number sorry seven eight nine. Let's do them six is optional and then after that we do exercise day one day two, sorry --> Clear on that so first before we all --> Going to ask in different sessions --> Uh, we are doing seven eight nine and within seven eight nine --> Are there any? --> Subsections that we must jump --> Uh --> Maybe either due to information not being available --> Most so so seven eight and nine most of them, uh, I don't think there's anything that you need to jump --> uh, so --> When you monitor your shared --> um just going through this but um --> Seven there's nothing that you need to skip --> uh, and then --> uh --> This one you read right, okay you distribute that --> um --> Let's see, let's see, let's see master slave replication using uh, right content for durability. Okay replicas --> uh --> Resolve replica failures. Okay, that's fine --> This one is straightforward. So you shouldn't have any issues. So seven eight and nine you should be able to do all of them --> Okay --> Okay, cool. Thanks. Yeah, I don't think there's anything that you need to miss out --> um --> Yeah, seven is good, uh, read write create a database --> Uh --> Read write distribute the reads, okay --> Uh replication you create your replicas --> You verify your replicas check the documents --> Uh set up master slave replication --> Okay, that's fine. And this is both on um --> On localhost because then it's just the difference within the ports and then it's a data into master --> Um verify replication. Okay, cool --> Then use right concern --> Okay, do you know d? --> Verify that handling. Yeah, so it should be good to go --> So the command are we are we are we --> Starting from six --> Uh, you can six six it depends with your language that you understand --> If that makes sense, yeah, because there is the part where --> It's in python if you understand python --> Then you can do this one because then it's going to connect to the db and query some stuff --> You can also change the queries. There's the java one --> Uh that you can also be able to query the data. There's the ruby one. There's the php one --> So it depends which one you you which language you understand which programming language you understand --> If you don't understand any this thing you can skip it but it sort of tells you how um --> What do you call this? --> Um, how all of this works in terms of querying of data using a programming language or how the drivers work? --> Okay. Yeah --> So --> Uh, who is who's speaking it's lucky --> Okay, just one second i'll go to your machine, okay what issue --> Command insert requires that. Um --> Let's see --> Let's do this --> Let's just switch it off so that it doesn't give you any issues --> But normally what you need to do is run, you know that bongo sh minus user and what what --> That's what you need to run it with --> Yeah, yeah, yeah, yeah, but for now let's let's just make life easy and just switch this off --> Switch the authentication off so when it when it asks you for authentication, it means --> you need to log off the database and then --> Authenticate using --> What do you call this --> Um authenticate using um --> Using that username and password that you created now so now you can you can continue --> Whatever you're doing. Yeah --> Okay --> Thank you --> Okay --> So --> So --> Just one second, i'll be right back --> You --> Okay --> When we try to initialize when I try to initialize the conflict server it says the --> Then the replication is not enabled --> Uh, let's see --> I been it's iven, right? Yes --> Let us initiate configure please set --> And that this node was not started with the replication. I think there is a missing command just one second --> Just to check on the thing that I sent --> Um, can you exit your database quickly --> So just type exit here and then open the config file --> So just do um --> Vim space etc --> For slash etc mongod.com there --> Yeah --> And then go down it says replication --> That's why that's why you need to enable it. So you need to write it as replication. Yeah, so um --> No, no, no, so just just um remove the hash --> Oh, yes, and then on the next line with one space then you then you write let me let me add it to --> um --> Let me add it to the chat quickly --> Where is the chat? --> Just add that line --> That I sent in the chat --> So you can change the name to whatever um name you want to add there --> Okay, wait, hold on let me see if I can paste it --> Okay, hold on --> Okay, if you want to change the name you can change the name --> Uh, if I change it, what effect? --> Um, what did you name replica set config replica set? Um --> Name it config replica set --> So you see the name that you gave it there on --> On rs initiate is config replica set. So just change that rs zero --> to config replica replace sets --> Can you can you share screen there because I feel like I've got the same issue. I think this is --> Okay, just --> All right, also I have the same issue is it the same --> No, I think I typed on the top. Yeah, can you see his screen now? --> So you went into mongod. Yeah the mongod.com --> Then set okay cool and then let's close that --> Let's restart mongod. Uh, just do a control r --> Oh there we are --> Usually what you do is just do control r so remove everything do control r type restart --> Yeah, there we are it goes back to anything that's got that word anything you want yeah --> Enter --> And then log into your database and then let's try and initiate it. Let's say I can run it and --> Started with the config server, okay. Oh you need to start that we need to run those commands first. Sorry --> Uh, we'd go on the the three the one on top. Yeah exit --> Oh --> Exit yeah, and then run those three the ones that have got --> Yeah, that one the number one right run number one. So just copy them and paste them. Yeah --> Yep enter --> Cool and then log in again. Yeah --> And then run it uh the --> We're running --> Yeah cells. Yeah, and then run let's see what error comes --> Okay, but you have them as config server --> Invalid replica set config it's weird --> Oops --> Did I lose connect did you also lose connection? --> Okay, all right, that's fine --> Sorry wait, there's a config I think we let's let's rather do the adding of the the config server in the --> Server --> Under sharding, let's see cluster row i'm gonna --> Want to copy paste something --> Shard saver --> Where did I put my teams --> Let's describe the new configuration --> Okay --> Okay --> Lucky when I how did you solve this issue as you are quiet? --> I didn't solve the issue --> I didn't do anything --> I tried to skip and then when I was writing things, so I just say refuse --> Yeah --> You try to see something --> I see --> I try to start just the connection refuse of something --> It caused by connection --> Movers and shakers then I was like, okay, let me wait for solution --> Okay, i'm waiting for solution --> do --> number --> Number eight. Why don't I look at this one? Uh, let's see. Wait read scalability. Okay --> Second, okay, but she still needs the secondary node --> Yeah, you still need the secondary nodes --> Okay, give me about 10 minutes, let me look at this and see what could be the issue --> Um, so 10 minutes for break because you're still gonna need it on number seven also --> So let me just look at this --> Let's see here --> Yeah, we'll be back at half past 11. All right, cool --> That's fine --> So --> Oh by the way, yeah --> So --> So --> So --> Okay, i'm back i'm gonna share my screen just now --> Let me know when you can see my screen, please --> Oh --> Okay, is everyone back --> Okay, cool --> So yes, i'm also here it --> Okay, cool. That's fine. So what i've done is if you go and refresh --> Uh --> The github there should be a new page that's called creating shards, right? So basically what to get us to do is --> It will get us to create --> a config server --> Shard servers and then among us the router, right? So it's a matter of um --> Just following the instructions. So the very first thing is you need to create directories. I think that was missing on the other --> um on the other instruction --> I haven't touched that instruction. So I haven't changed anything but for it to be quicker --> I thought let me just put instructions to create a cluster. That's got three nodes --> um --> And all that stuff. So firstly you create the folders then after you create the folders you then start the config replica sets, right? --> And then you connect to one of the config servers and then you initiate --> You replicate you initiate your replica set right and then you verify your status --> Um, and then you start the shard servers. Um, so it has worked for for me, right? --> Um, so which means it should work for you guys --> um use self --> Right and then uh, let's let's try and see --> Let's use --> Come on move this --> Because I can't copy now --> So for example, let's log on to --> This one so be mindful where it says mongo. It means mongo sh --> um --> So for example this right, uh, it means mongo sh --> So you need to add that sh because or else it will fail --> So what i'm doing now is i'm going to log into one of the --> shards, right? --> for um the cause the shard, um, okay, I can start with um config server rather --> right --> So i'm gonna paste that and then --> Right when i'm logged into this automatically tells me that i'm already in the primary --> Node right and when I want to verify that I just need to come and take this --> and then just run it in there and --> Then it will be able to show me that um, there's a secondary that's on two seven or two one --> Um, there is let me --> expand this --> So it will give me information where does it start where does it start so --> Array status config replica set, which is the set --> Uh the date my state and all that stuff config server is equal to true --> And then it will then be able to come here and then tell me that the one because it's a local host remember --> so, um what differs is actually the port numbers, but um --> What you call this let's say if it was --> Uh three different servers then you would have here the host name and the port being the primary --> and then --> um --> The local host the next host which is one secondary and then the next host which is another secondary --> And all that stuff and all that stuff. So this is just three one primary and two secondary --> That's the config server --> and then you can then exit and then --> uh log in to --> a shard --> Right, you would have started the shards and then uh for you to log on to this one --> uh, you then go there and then --> Sh i'm now in a shard in um, what do you call this? Um --> Primary so shard one replica set which is primary --> Uh sales, um, and then i'm in the sales one and then if you want to --> Uh check any replica sets or what's happening with the to verify the replica set? --> And then go there and then add it to that right at the moment you run that --> You'll be able to see that. It's actually the primary --> right, um --> And all the information then if you log on to the next one --> To be able to show you that it's actually the secondary as you go as you go --> So just look at this page that says creating shards and then follow that --> It should take you to the point where you even create the routers and all that stuff --> Clear --> Uh, yes and no --> so --> Creating shards --> Uh, the summer where you say yes or with no --> Just follow me --> Do we start with preparing directories or yes, no no no prepare the directors first create the directors first --> That's the step that I said was is actually missing in the in the number seven in sharding --> So prepare the directory first --> And then once creating shards is completed then we go back to number seven. Yes, then you can go back to number seven --> Then you can add all this information into cells and then --> All this part is done for you already, right? Um, you've created the shards already --> All you now need to do is you're monitoring your shards --> Uh, you monitor your chunk distribution you monitor your query and all that stuff --> I'm going to fix it so that we'll have all the instructions in one place in one document number seven --> but for now you can --> Go use the creating shards and then from after you've created your shards then you can go to number --> Well, it's number --> What's the c start query routers, okay --> You start them on the other side and then you can add shards to cluster. You've you would have added it already --> So you're basically going to do the monitoring of the shards after adding the data in the sales database. So --> That's basically what you need to do --> So go create the shards and then come back if you haven't added any data into the database --> Then you need to do step number one b if you have added already then you just need to monitor --> And then when you go to number eight, um, you don't need to set up again the --> The sharding part of it you create --> What you call this a library db you add the data --> And then you continue to do the horizontal scaling the vertical scaling and all that stuff --> This number three you have done it already and uh, you have it set up already and then --> All you then need to look at is you're using your right content for durability and all that stuff --> Happiness --> Okay, so --> Right now what you need to do is --> Go do --> Creating of shards right when you are done with that. Let's move on to the next one --> I think that would be easy because in the earlier instruction, right it was starting from --> Starting the config servers, right? --> But we didn't create any folders --> Right, so go create the folders follow the next instructions and do whatever it is going to tell you to do --> When you are done there, then we'll look at number seven --> Yeah --> And these folders are created within --> Sales, I'm assuming no. No, so this is this is os level. This is not in the database. This is os level --> So remember anything that's that doesn't have --> Instruction of mongo sh first, right? It's os level something that doesn't have db dot something. It's um, --> It's os level so you're creating this on the os level and not on inside the database --> So you exit from the database? --> Do all these instructions? Um wait then says mongo then you know that you're logging into your database --> If that makes sense. Yeah --> I don't know how to write the tag --> All right, it's no problem. Let me just change this mongo what what to mongo s --> This is to be mongo sh --> And --> Sh --> I must wait for you to finish so that we can refresh the page. Yeah, just one second --> Let me just change this stuff quickly --> So that you can just copy and paste rather than having to --> Just give me a second I should be done in a bit --> Three shot two shot one --> And --> Okay --> Okay, I think it should be good to go i've changed that mongo sh --> Uh start mongo s --> Like that. Yeah, they should be good to go --> We must just refresh --> Yes, just refresh and then --> Uh, you should be able to just copy and paste it tells you the instruction what you're supposed to do --> But it also gives you what to copy and paste --> So for me, it was literally just copy and paste --> So there I see on step number five is that the mongo --> Mongo s router. Yes. Yeah. So this one is just mongos --> Yes, yes, it's mongo s we're starting mongo s --> Okay, okay --> It's the query router. Remember there's mongo d there's mongo s there's the config server --> Yes, yes. Yeah. Yeah. So it's the mongo. It's the mongo s that you're starting --> So --> Okay, how long does it take I see for me I write that command it looks like it just stopped somewhere --> How long does it take yeah, because when I start okay it failed child process failed --> Uh, I didn't get that error, let's see your machine who's talking lucky that's your machine --> Uh add the dash dash fork, but the dash dash fork is there. Um, okay --> Let's see --> Let's see what it's giving us --> I'm gonna share your screen just now --> I think these ports are already used and config replica. Okay, 27017 --> Okay, let's see --> Okay --> Okay --> Let's see what area we are getting here mongo setup complete something like that --> Transport layer entering that exiting that shutting down --> So --> It was your port number --> Okay --> Yeah, so --> 2027 --> 17 is already being used. I'm not sure what using it --> But it's probably one of the shards or something either one of the shards or config servers --> So I just changed this to 15 and then uh, it has started --> I don't know what happened. Maybe I was just running something and then it created. I don't know --> Maybe just because probably earlier on you tried creating something that was running on that port --> And then while it's going through it. Yeah, it could be that also it could be that on the documentation that port is repeated --> um, so let's see --> 27 --> Seven that's 24 23 22 --> Um 22 23 24. These are shards --> And 19 20 21 --> Yeah, so it's probably --> Uh, yeah, maybe on number seven because I ran some other stuff maybe somewhere there --> Yeah, it could be it could be a 19 20 21 --> uh --> 23 yeah, it could be that it's one of those exercises that you run them. But anyway, it's okay now. It was just a port number --> Uh, okay --> Yes --> Yes --> uh on my site, i'm also getting a --> An error when i'm trying to start the --> config server replica --> because of the --> Processes, let's let's see paste. Let's see. I'm on i'm on your screen even --> Okay, so it's talking about the child process --> Um, let's see. Let me share your screen --> Child process, sorry, which part did you use because I mean two seven zero one I changed to two seven zero one five --> So let's just change it to two seven zero one five --> um --> Ivan i'm gonna change it to two seven zero one five and then let's see --> One five --> Okay, this is taking long it might actually fail --> Okay --> But let's see --> um --> What's the lady's name again? Are you also having the same issue? --> Yes, okay. Yeah, it should be a port number --> Uh, but let's see. Let me get there so that I can also have the same issue --> Yes --> Yeah, this is taking too long just yeah, let's see --> Okay, let's do this --> Yes, let's see what could be happening --> Logs and then --> Minus n 20 lines --> Fail to refresh query try again --> Network --> Not find matching host read preference primary did you set up the primary? --> I'm not sure which part is it --> So --> Wait, so did you create the folders and then started the replica? Yeah. Okay --> Okay, let's let's quickly check something --> Because here it says failed to refresh key cache --> um --> Come on, let's move this --> Uh fail to satisfy read preferences could not find host matching --> Read preferences more than primary preferred for set configure replica set one, right? --> So it's trying to look for --> um --> Uh for a primary and then it can't find it. Let's see --> And then --> This you don't really need to --> Didn't initiate your replica set --> Uh --> No, because I start --> Those first ones before this one --> Okay. Well, this is --> replica set the config replica configs the thingy --> Then I think now we should be able to start right? --> So if we do that --> because for me to get to the initiate and I had to start with the --> the folders --> The config after the folders the config server replicator replica set. Okay, so it's the one that was failing --> Okay, wait, this is the mongo s part --> Which is far down below? --> So --> Had which one was which one had you said is failing? --> The one above this one --> Yeah --> Oh, is it? Okay, then that's why it's failing because then it doesn't have everything --> But having said that now it's got this is running the config server part is running --> All right, because you can see with this right? It's got information. It's got the secondary now --> Uh, it's got another second. So this part is running right? --> Um continue from here right because then you need to create the shards after you create the shards --> Then you can create the mongo s router --> Okay, yeah --> and then i'm gonna change this let me change this port to --> Wait, let me see something --> P --> 17 is already being used --> 15 is already being used so probably is 14 --> So I think as a way to figure out --> The posts that are open. I'm not sure if you guys have used. Um --> net start minus ntlp --> So you say up --> install --> nets --> tools, right --> and then --> Go through the whole process of installing whatever it needs to install and then you write you run --> Net start minus ntlp --> Right what it's then going to do is going to show you the open ports, right? --> What open ports and what? --> Our program is using it --> Right. So if you get to this point and the child is failing to create the child just check this --> I'm going to put the instructions in the chat --> to write um to run --> Up to install tools net tools and then check the ports and then use a different port. That's not here --> So for example, two seven zero one five then you need to use two seven zero --> um one four for example in this case --> It makes sense --> Yes. Yeah --> So i'm gonna put the instructions in the chat window to add this net that two and then do what you need to run --> And then it should be good --> Okay, yeah, so for you go through now go through the sharding part because you did the --> um --> I've just sorted out the config server. So now you need to go through this --> Uh shard starting of the shard servers --> Uh winnie, did you manage to follow suit? --> Okay, let me go to your machine --> Just for understand, yes, um, one number five is that where the issue is --> Uh number five five starting mongoroot. Yes, there could be an issue of the pot --> Okay --> Okay, let's see what winnie has been busy with here --> Welcome --> That's going on now let me open that --> Okay --> To show your window winnie, I don't seem to pick it up maybe it doesn't want you to share --> Uh, because I can't pick it up for some weird reason, okay --> Wait, let's see what's happening here --> Okay --> So --> mongo db config server --> I think the error was you were trying to create those folders in a database --> Yes, then I agree --> And then uh mongo server db you created that --> And then mongod config server. Okay, it managed to create that --> Mongo sh you managed to do that and then when you get to the mongo sh part --> What you need to do is actually run --> the initiate --> Right, which is uh, let me move this quickly --> Which is this part first? --> right, um --> Sales you can use the cells you can use any database, uh, but now you need to run this --> To then initiate that we are good we can verify the status --> And if you be good now --> Now it can show you that there is a cluster. Um, there is a secondary which is this port 21 --> um another secondary which is port 20 --> Uh, and then another secondary which is port 19, which is 19 --> 2021 these ports that are here so now you can continue this part --> um just follow the steps as is but --> When you get to mongo sh this this you're running it in the database --> So just be mindful of that part --> Okay. Yeah, so you should be good to go to continue --> Okay. Thank you cool --> anyone else --> Yes here who is that? --> Uh --> I'm here, but you know, i'm i'm struggling today a lot with work, you know, I have I have meeting now at 12 --> Oh, so you're juggling with uh with practicals today. So i'll try and catch up later. I just hope that um --> Yeah, I i'm gonna be correcting the --> The errors the number seven, yes, i'll do that. Yeah, i'll do that --> So I i put in a sort of a quick one --> But i'm gonna incorporate everything into one into number seven so that people don't get confused --> Well, it's two minutes to 12 now. How how are you going to? --> Get into a meeting and yet it's your lunch time --> Apparently you like activities under the nose --> I I don't have a choice --> Okay, no problem. So yeah, we'll take 12 o'clock lunch come back at one --> in the meantime, i'm just --> I think let me --> Um live as is for now --> Uh, and then when we have confirmed everyone else is done with the creating of the shards --> Then i'll edit into number seven so that it doesn't confuse everyone else. I don't know if that makes sense --> It does --> Yeah, no it does does does yeah, all right cool so it's lunch time now we can go for lunch come back at one o'clock --> Then we'll assist whoever is having issues --> Oh --> You must have taken --> What issues are you having --> Let me have a look quickly before we go to lunch --> Let's see child process --> um --> Child process blah blah blah --> um --> Do apt install, let's see your --> Just remove that line that whole line --> Let's see what ports are open. I'm pretty sure it's the ports. So apt space install --> Okay, let me let me type it's fine. Um, let me type --> uh install --> net truth --> And then let's start --> So 17 is taken so you can use 16 --> They are done it's also good be mindful that that mongo sh is now to port --> 16 not 17 change that to 16. Yeah, then you should be able to login --> Yeah --> So you see direct mongo s that means that's your mongo s that you've created --> Then you can do the rest, okay, i'll see you guys at uh one o'clock --> Off for lunch --> Yeah, I will come back --> It what --> But also but also will akona have enough lunch time because he's getting to a meeting now --> And we benchmarked his account. I went to lunch. All right, cool. See you guys at one --> Okay --> Things to do --> Always comes to say hi to me for the past few months he always comes to say hi, I think he has a thing --> So --> Conversation and then I'm like, hey, what's your name? By the way, and he tells me his name --> I'm like, oh, well, he's a little --> And then i'm like, oh very simple by the way, he's like, I know --> I call him by his name --> We introduce ourselves --> It's just I just turned out this viral prompt the people are using --> It's just looking into your soul telling you uncomfortable truth around yourself --> They can't --> Yes --> Is --> And --> So I ask her --> So I always go by that so for real are you willing to include me and your roommate that's paying the same amount of friends as you are --> The same man who obviously is not doing anything for you because --> Is what I can't hear you --> Asanda --> I didn't --> It's not fun --> Don't play with this --> Don't play with this --> This is the most heartbreaking thing I have seen on the internet, and this thing of us --> having a tendency of telling people how they must react to what is happening to them --> is madness, you know? --> We're trying to see as much as we can while seeking shelter. --> This ongoing fighting in the streets is M23, cleans it block by block, trying to --> cement their control. --> We see Claude and Anne have to be tamed together to work with them in one space. --> First, go to Curiso.ai. --> It's completely free and open source, and the developer used to work for the media. --> Click here and download, and then go right here to the app, right here, and click --> this, and it should go ahead, and once you're inside, it should look like this. --> So create a new board. --> This one's called test, and then we're going to go to our settings and chat, --> and as you can see, it also lets you do clocking. --> I tried this challenge on my body. --> I tried it on my body. --> That's what I did. --> I didn't make a song. --> If you check the rules in Perpetual, and guess what? --> You will be the one who got the challenge for 10,000 friends to come up with a new --> ring. --> This lady on the right was a fountain dress inspired by an anti-ecco. --> And she decided about two to three days ago that she wanted to post a --> I'm going to do a TikTok dance for you. --> I'm not too fast. --> Don't forget to create any mobile app, website, --> SaaS company, tag group. --> I'm going to do a TikTok dance for you. --> I've been reading about China and some other companies --> that are coming up with a faster method of AI --> and a much less expensive method. --> And that's good. --> Because you don't have to spend as much money. --> I view that as a positive as an asset. --> So I really thank you. --> Okay. --> Oh, I'm sorry. --> I'm sorry. --> Yeah. --> Okay. --> Okay. --> Okay. --> Okay. --> Okay. --> Okay. --> Okay. --> Yes? --> Hello. --> Yes. --> And? --> And I didn't see. --> Cause I need to go for a haircut. --> Not yet. --> You need to go for it, you can't --> We haven't started combing yet, don't rush it --> Okay --> Not now --> Not now --> That is a great time --> Not now --> That will be good --> Not now --> Not now --> Mine still doesn't work from where --> the last time where you assisted me with --> from the --> SH status --> Okay --> Did you --> Did you do this part --> Hold on --> Hold on --> So RIS status --> and then you log out of the --> database --> And then --> we go into the shard --> You log into that --> and then we initiate that --> Okay --> That's fine --> And then exit that --> And then --> the next one --> Initiate --> Okay that's fine --> And then shard number 3 --> Okay --> So it's more or less --> the shards --> just confirming the shards here --> and --> Okay cool --> So let's verify --> the replica set status --> It should be able to show --> There is the primary --> So this one is the primary --> Right --> Okay --> And the shard replica set --> And then we can then --> go onto this one --> So exit that --> And then --> I'm going to change the port --> to 12 --> Okay cool --> Then yeah --> You should be good to go --> So for example --> if you're going to do this one --> Change the port to 12 --> And then you should see --> it says Mongo S --> Okay --> So you can then --> continue with --> adding this --> You still can do them in this --> specific console --> Okay thank you --> On my side as well --> I'm getting errors --> when I'm trying to --> I think it's sharding --> What number are you trying to --> Yeah I think it's --> You need to exit the database --> Anything that says --> Mongo SH you need to exit the database --> first and then you can run it --> So you can now run that --> Mongo SH port something --> Yeah I ran that --> first I think now I was running the --> You're running it in the database --> Yeah so run it again --> Because you are going to need to --> Log into that --> Shard that you want to --> That you want to run that command yes --> Where your cursor is --> So for this part I must log into the database --> Yeah that's what I did so --> If you look --> So this is the error --> Yes it's because you ran this --> command here --> You ran it in the database --> You're not supposed to run it in the database --> Now you can run --> the next command --> It should yeah that one --> There you are --> Then you exit again then you run --> Shard number 3 --> Otherwise you --> You will run it --> In the database --> Thanks --> No stress --> Are we still creating shards or are we back to --> Sharding number 7 --> Are you done with creating the shards --> Are you done with --> Yeah these guys are slow --> Let's wait for them to --> Finish that part --> Sorry --> Did we say we want to do the --> Routing --> Yes the Mongo is --> When I try to do it it tells me about --> The child process --> Change your port the last port the --> 17 change it to 12 or --> Something --> Yeah because it's probably running --> With another process 19 --> I think it's being used so change --> It to one yeah and change it to 12 --> 12 --> 12 --> Yeah --> Yes --> Those --> Router --> Commands or this could --> Yes --> So --> No no no --> So you see where the top part where it says --> Mongo SH port --> Put the same port with your --> With your --> So it's supposed to be --> Two I think you did one two --> Yeah because it's supposed --> To be the same port with Mongo S --> And then you can --> Run those the ending of the --> Shards --> Yeah --> Ah --> Yes --> Then you can verify the status --> It's --> Ah --> Yeah so --> Um --> That's how it just works so you --> Can then create --> Enable sharding for a database --> So for example you can --> Use I think it sells you can --> Create for sales so instead of --> My database you can use --> Sales in there for example --> Yeah --> Oh because it's already --> Yeah it's already there --> Does it mean then on the next one --> Then I have to change the --> Name as well --> Yes --> Sales I'm not sure what --> Else was in the sales one I --> Think you can check on number seven --> It should be able to tell you a collection --> That you created --> So if it's my collection then it will be --> Sales --> Just go to number seven --> Go to number seven --> This one yeah go to number seven --> And then --> Use sales and set --> Many order I think order --> Order is a collection they just --> Go back go back go back up --> Create a source database and --> Set data so use sales --> And then there's --> Orders as one --> So you can use orders as your collection or --> Products as your collection --> Okay and then the field you can --> Use I don't know customer --> Name if you want --> So instead of number one we can --> Replace it with --> Yeah but you need to add the key field --> So what is your key field --> Products --> Is it products --> Just go to number seven before you --> Change anything --> You can --> Add --> Order ID even if you want --> Order ID --> You can use order ID as your key field --> Order ID is uppercase I --> Yeah then --> You can --> So you're shutting in --> Yeah you can then press enter --> I think you should be good to go --> Will it be the same if --> Verify in the class that I must change --> The name to --> Yeah so --> You can --> Use my database --> It's going to create a new database --> My database and then it will just --> Do insert data into --> Collection so for example --> If you had not changed the names --> On the top commands right --> Then it was going to make sense but you changed --> The names on the top commands which means --> Then you need to change --> That information so what you can --> Just do is just remove --> That just copy them --> As is don't change it don't add --> Any database name or anything --> So if you go back to number --> What number is it --> Just one second so if you go --> Back to start number seven and just --> Copy and paste so that --> It creates a database by the name --> My database and then my collection --> Code that yeah --> One second I'm coming --> Go --> Okay --> Yes --> Seven sharing --> Initializing the server --> Config set --> Do we do it inside the database or outside --> I tried both --> And still gives me issues --> Which one number --> Number two initializing --> The config server replica --> Said --> Let's see what the error is --> It's supposed to be in the database --> Okay mongo server error --> Common command not --> Found no such command --> Where is it --> Getting that command that you're running --> Let's see --> It's supposed to run it in the database --> Config replica --> Set --> Okay what's happening here --> This is mongo s --> Wait what are you --> Doing up here --> So you are --> Support your next step after --> Creating the mongo s --> Is where is it --> So you've done this part --> Right and you've done this --> Part correct --> Which says --> Started mongo s what what --> Because I see it in mongo s --> So your next part --> Which is this one --> Yes --> So you're actually --> Here right --> Let's see --> Wait --> You are --> Supposed to be adding shards --> Because you've created --> The mongo s right --> With whatever part --> So now what you need to do --> Is this part --> Right that's where you're supposed to do --> The next step --> I don't know why replica --> Set initiate --> Because it's failing this because --> You're in mongo s you're not in the replica --> Set but you're in the mongo s --> What do you call this mongo s router --> So you can't run --> This part --> This other is initiate --> In the mongo s router --> You need to add --> The shards so that it --> Can direct --> The --> The writing of the data and --> Spread them amongst the shards so do this part --> Right and then continue --> I'm done with that part --> Which on this part --> I thought when we are done with it we have to go to --> Yes and then do the monitoring --> Part --> Yeah the monitoring part --> Oh so if you are done with this part then --> Your next --> Thing --> That you need to do --> Is --> This part number four --> Because I started the other job --> So number one to three is --> The same thing that you would have done in creating --> Shards so you don't need to do --> Number one and three --> Thank you --> I see you --> Now you tell me to wait Mario --> We need to continue --> No I started on my own --> She had started on her own --> She had started on her own --> So number seven you can --> When you go to number seven please --> Do number four --> From number four --> Yeah --> Don't worry about one two three because I'm going to --> Change that --> But from number four then --> You can then --> Continue with that --> Let's continue and see --> I think you might --> Want to change the last number there Winnie --> Two zero --> Two seven --> I think it was what? One something --> If I'm not mistaken that you used for MongoStats --> Yeah let's see --> Is any column missing --> Wait --> Log off sorry --> Log off from the database exit from the database --> Yeah now run it --> But change that number so paste it and then --> Change that number to twelve instead of --> Twenty four make it twelve there you are --> Thanks --> Alright cool --> Ah problems --> What did you --> Break --> Let's see let's see --> Let's see --> What's happening --> Library no search command enable --> Sharding what number are you --> By eight --> Eight point two --> Okay --> Enable Sharding the library --> Database is enable --> Sharding --> You're not supposed to --> Be connected into your MongoStats --> I'm following everything --> Wait so --> It actually says are you connected to --> MongoS so you're supposed to connect to --> MongoS first --> Then you can edit you can do your --> Sharding so exit that and then do --> MongoS something something --> I'm not sure just --> Control R --> MongoS --> Space --> Space --> Space dash dash --> Space dash dash --> Why is it not giving you the --> So --> Wait hold on I'm going to take control --> So you're supposed to --> Use this one --> Crap --> Oh yes it's MongoS --> And then you can then --> Start doing this --> Use library did you create the --> Library database --> Yeah the --> Top one I --> Believe I did --> Then you can then continue with this --> So things like enabling Sharding --> Adding Sharding you need to be --> MongoS --> For you to be able to do it --> So now you can continue --> Alright thank you --> Cool --> Ok Kumbelani --> Winnie --> You broke again --> Yes I'm back again --> The monitor balance --> Activity --> When I tried to even run --> That command it's not --> Saying the syntax error near unexpected --> Token --> Monitor balance activity you need to --> Be --> In the --> What you call this in the --> MongoS try to --> Try to run it when either in the MongoS --> Or in the MongoS --> So for example if you say --> MongoS and then --> Try and --> Monitor that --> Actually no --> You need to be in MongoS --> MongoS sorry --> MongoS --> This one --> And then because then there is --> The cluster --> There's the Sharding then you can be able to --> Run it --> There you are --> Ok thank you --> No worries --> I am back --> Ok --> Let's see --> Can you be able to find --> Secondary --> Let's see --> 2B --> Number 2 --> B --> Use secondary nodes for read scaling --> Try --> Distribute --> Reads and writes use secondary nodes for --> Scaling --> Try and capture later secondary --> All caps --> So just one up arrow and then --> Change that to secondary in caps lock --> Sorry I am only back now --> I see my friend --> It is still struggling --> Later cases --> The dot --> Books dot find --> In library --> Wait --> So --> That collection is library dot books --> Use secondary nodes for read --> DB dot --> Books dot find --> Why is it DB dot books --> And yet you --> Have --> Your DB is --> Library --> Change that to library --> Let's see --> DB dot library dot find --> I wanna check --> I wanna see something --> And then the secondary is small letter again --> Yeah small letter --> Ok then it's best to just go to the --> Original --> Where was I --> It's happening to my mouse --> Why is my up and down not working --> Anymore --> Up and down --> Up and down --> Is it not working --> Now let me just copy this one --> And change the focus --> Library --> That's weird --> It's supposed to --> Look like that but --> But that has taken --> Too long --> So it doesn't make sense --> I will change the secondary to caps --> To see if --> I could not find the matching read --> Mode secondary for set --> Shared replica 2 wait --> Hold on --> Replica 2 --> Shared 2 --> So --> Shared 2 replica set --> This one --> Shared replica 1 --> Shared replica 2 set --> Let's do something quickly here --> MongoS --> Let's --> Get into this one --> And then --> Check the status --> It's actually primary --> Replica 2 set is actually --> The primary right --> Let's check replica --> 3 set --> And then the status --> So I'm assuming --> You need to change --> Why are they all primary now? --> Replica 3 set --> 2, 0, 2, 4 --> Shared separate replica set --> 2, 3, Shared 1 --> Shared 1, Shared 2, Shared 3 --> So we don't have any read replica --> Is that what we're saying? --> Any secondary --> You're doing number what? Number 8 --> Or number 7? --> 8 --> On which number? --> I think 3 --> Somewhere there --> 8.3 --> This one --> Check 2 --> How is that? I know --> Somewhere on top there --> Yes, that find --> That find here --> I don't think --> So you did this one, you did this one and everything is fine --> Yeah --> My worry is they are all showing --> The --> Okay --> Just didn't find at the time --> No, but are we saying --> It didn't find anything or --> Just didn't give us a response --> Which is weird --> Okay, wait --> And then --> This is where it's failing --> Not --> Secondary --> Come on --> Come on --> Just be honest --> What did you do? No, remember --> I said --> Is everything working? --> Okay --> Replicaset --> Shard 2 --> Replicaset --> Could not find host matching read preferences --> Mod secondary --> Which I understand because --> It's not --> So this one is primary --> Replicaset 3 --> This one is 3 --> This one is --> Replicaset 2 --> It's only --> Got a primary --> Which is weird --> Okay, let me have a look at this information quickly --> Okay --> I created the --> Shards --> Among us --> Let's see --> Okay --> Okay --> Okay --> Okay --> Okay --> Okay. --> Okay. --> Okay. --> Okay. --> Okay. --> Okay. --> Okay. --> Okay. --> Okay. --> Okay. --> Okay. --> Okay. --> Okay. --> Okay. --> problems. That's what happens when you are good. I'm just looking at that issue. So I picked up --> that we needed you need to add a secondary, right? But now the connection, I want to make --> sure that it can connect. That's what I'm trying to figure out. That's what I'm trying to sort out. --> And then they say there's a part where it says request callback. And then you keep this request --> a callback for me and put in my numbers. Because remember, I spoke to them last week, --> they supposed to have delivered, but they're not saying anything. So I don't know what's --> making it. So I'm just trying to troubleshoot connection to the secondary. --> Yeah, secondary. Hold on. Were you the one with the hand up? No. Okay. Winnie, was it you? --> Was it me? But I'm stuck as well. You're probably stuck on the same one? Yes. Okay, --> cool. So what I'm trying to figure out now is why it's refusing connection. So first things --> remember, we just had a primary, right? Which is this one, but I added a secondary --> on this port, but it's not reachable. That's the issue. So the way you'd add a secondary is --> just by you log into whichever one that you want to add a secondary. And then you add --> just like this. And then the IP and whatnot. But now, this is now I just need to figure out --> this part, why it's not connecting. So just give me a bit to finish that up. I think --> 2032 is good. --> You see, connection refused. --> Failed. --> Okay, I think I found the solution. I'll just be with you guys now. --> No, no, no. --> I'll paste that and then change --> secondary and then change this to three. --> Okay, thank you too. I'm back. --> Well, let me still unmute. --> Okay, cool. So just to refresh your --> Okay, cool. No problem. I'm just gonna quickly use the bathroom. I'll be with you just now. --> Okay. --> You're blocking the queue. --> Like how much too much. --> But --> yeah, normally, yeah, yeah, yeah. I keep quiet after lunch. --> Yeah. --> Okay. --> Okay, I'm back. --> Are you good now? Yeah. So just minimize your what you call this your terminal. --> I'll make it smaller. It was so huge. I think top yesterday. Now refresh your browser. --> Yes. Yes. Refresh that. Go into creating shards. --> And then go where you're creating directories. --> So just copy the last one on the first line. Copy the last one on the first line. Oh, it needs to be MongoDB. So the on the first line, there's the last part. --> No, no, no. On the first line. --> Yes, the last part. Yes. No, no, no. Just copy the the last few parts. Yeah. Okay, hold on. Hold on. Let me. Let me do this. So it's supposed to be this. --> So what we're going to do is we're going to create a folder for the secondary, right? --> And then here it's supposed to be Mongo. Please, the rest, please hold on so that I correct that first. --> And get the R MongoDB secondary, right? So which means you've got a directory for secondary. So we're going to create a shard. --> For this one that we created. So a secondary shard in the replica set three, in shard three replica set, right? So we come, we initiate it. --> Copy that part. We're going to initiate the secondary before we edit. --> Right. I'll explain something here. --> And everyone is quiet at the time. I'm not sharing my screen. --> Everyone is on the lunch. That's a very long lunch. --> Okay, let me see. But Win is here. So let me just share my screen. --> So what you want to do now is you want to initialize. We want to start the secondary shard, right? In replica set three. --> Because when we are doing this, what we're doing is we're just creating primary shards, right? --> In the different replica sets. So let me move this. --> Yeah. So in essence, we created the primary shard in the replica set one, a primary shard in replica set two, primary shard in replica set three. --> Now, if we were to create all this to say everything wanted to be in one replica, then it was meant to have, the name was supposed to just remain as shard one replica set, if that makes sense. --> Right. So for example, now I'm going to add a secondary in shard three replica set, right? So then you've got it in three replica set, but on a different part, right? --> So you then come here and then copy that and then come here and then paste that. --> Right. And then. Right. It is created that that secondary one in shard three. Right. So we then come to replica set shard three. --> And then we log into it. --> Come on. Right. And then we log into that. And then now we need to add that. --> What do you call this now? What did I do now? --> Let me re-share because I don't know what happened here. I'm going to share it just now. --> This is what I'm looking for. --> Now, when you're in there now, we want to add that, the one that we initiated. So it couldn't log on because it couldn't find that shard. Right. So then it was, I think it was 33, if I'm not mistaken. You do an RAS add and then you do an RAS status. --> Right. Then you should be able to see this now. Right. Which is connected. So. --> Sync source host is 2024, which is the primary and this is the secondary. And if we go up, we should be able to see that primary. So now, if you then go and run number. --> What number was it again? --> Yeah, that's fine. Yes. Let's do this. --> Let's enable sharding in library. Oh, I'm not connected to MongoS now. So your Mongo. --> Is H dash dash port 27 zero. What was it? One six or one four for your MongoS? --> One six. --> Yeah. Okay. Cool. Now. --> We then say SH enable sharding on library. --> Right. Enable sharding that that. And then. --> That. --> So it says shard collection, library.books, cluster time, blah, blah, blah, blah, blah, and then our moment of truth. --> Okay. It's still not picking it up. So, which means we need to shard. Let's see. --> Okay. So this is setting up a new replica set. --> Verify replication. And then check document. Okay. --> This is a bit weird because it's supposed to still read that secondary. --> Which is weird. --> Right. And then. --> And then. --> My friend says I'm a skip problems. I might just continue at number three. --> I'm a sort of skip problems. --> Which is quite interesting because then the setup would have would be different in that --> you need to create a replica set after which is which one makes sense because you used to create --> replica set and then you do the reading the using of secondary nodes for read scaling. Right. --> Yeah. But continue at number three. Let me look at this again. --> Because it's also not confusing me as a person. --> Yeah. No, no. As long as you're the one that says it's not making sense. --> Look, you usually would create a replica first. Right. Your replica. And then you can set your --> read replica and then continue with whatever you're doing because you've set the read replica. --> This one of if I need to actually exchange would actually be interesting. --> So if I continue at number three while I'm missing a secondary node here. --> So you might. --> So so so my my my thing is you might what you call this you might. --> It might work in this way where you create the distribute the reading rights. Right. --> And then create a replica after which doesn't make sense to me. Honestly. --> Um, yeah, because number three is actually setting up a replica and then that that that --> my replica set get help URL. --> After get up dot com, it says cumberland. Yes. But it doesn't make sense to you. --> Remember, we take we take all this stuff from our what you call it called collection of --> that was stored in the company. You see now. So it could have actually been that --> the previous trainer didn't actually use the vision that I'm using now. If that makes sense. --> The latest vision now. Right. So what you do is you pull that information, --> you pull that code and then place it into your report and then be able to use it. --> Yeah, you know, hopefully, the session that you are having tomorrow find smoother. --> Yeah, it will be smoother. Yeah, it will be smoother. --> Okay, can I take a quick break? That's actually how to I'll be on a break. --> All right, that's fine. No problem. --> That only applies to me. The rest must continue working. --> They are too quiet. Are they even there? --> Yeah, we're still here. --> Okay. All right. Let me just look at this. --> Okay. --> Okay. --> Okay. --> Okay. --> Okay. --> Okay. --> Okay. --> Okay. --> Winnie, are you still there? --> Yes, I'm still here. Sorry, I got distracted. Somebody --> at work wanted me to check something for them. --> All right, that's fine. No problem. I will shut down that. --> That I'm about to do a school run around past three. --> Oh, is it? --> Yeah. --> Okay. What was I using? What was I using? --> Okay. --> So what I've picked up is that he just needs to use the correct library --> when he gets here. So he logs into MongoSH, logs into the right library, and then everything should be fine. --> But I'll update the documentation. What time do you need to start your school run? --> I have to leave the office at quarter past three. --> Quarter past three. Okay. --> Yes. --> Okay. Anyway, let's see in your machine, --> wireless is not around. Let me connect to it. --> Okay, let's see. --> So let's create an index that starts with that. --> So the first thing that I'm going to do is --> I need to check on your 12th article 24. --> I'm going to check if there is a secondary. --> Okay. --> It's only primary, right? So we're going to add a secondary. --> Where is that creating a shard? --> The very first part is creating the directory of the shard. --> So let's do that. --> You're chasing me away. --> Sorry about that. Someone is saying, but you might not leave me. --> They don't want you in the office anymore. --> No, they don't want me in the office. They're tired of me. --> Okay, cool. Anyway, so after we create the directory, we go and start the, --> I need to refresh the, so wait, I need to, we need to then start the secondary shard --> under shard replica set three. --> Right. We go there and then we start that. --> Let's see if it's a four. --> Okay, that's fine. --> And port 27033. That's fine. --> It is created successfully. So now we then need to log on to --> port 27024, which is our shard number three. --> Right. We log in there. --> And then we do, I think it's this and then --> localhost and then port 27031, is it 3133. --> Right. So we add it to that. --> How? What's the command for this one? --> What is that command? To add, to add, it should be rs add status, status. --> Where is it now? Can't find that command now. --> rs status. --> David books. Hey, --> it's supposed to be rs add. --> Okay. --> And to log on to that and then rs status. --> Oh, it's brackets and not the name. --> Where is your machine now? --> That's square brackets, but normal brackets. --> Now it's so it's added now. So if we do status, --> we should be able to see 2733, which is secondary. --> Right. We've added that. --> So now we need to log on as mongos. --> What was it again? Your mongos. --> One, one, 12, one, two. --> Yeah. --> Sorry. Yeah. --> And then let's close this. --> Now we can go and enable sharding, which is number eight. --> First, let's use library. --> Use library. --> Right. Does it have any collections? --> Okay, cool. So which means the information is there already. --> And then I just need to move this. --> It's distracting. --> So it's even there. --> So we've enabled sharding lunchtime. --> So we've enabled sharding. --> Right. And then, um, then call and then shards, um, that create an index. --> Why do I need to create an index? --> Okay. Now I'll need to do it from --> Um, --> and the seven zero to four and then use library and then add db dot library dot create --> index and then it should be the score ID hashed, I think. --> Uh, control R index create index. --> Okay. Let's make it easy. --> Let's just go to indexing and then get index create. --> There we are. --> So then we come here. --> Oops. --> What do we do now? --> Okay. --> Now it's what? --> What collection does it have again? --> They're at the db dot library. --> Okay, cool. --> Hashtag is now sorted and then I go back there. --> I plug into mongolsh and if we go back there. --> Um, yes, library. --> We change login to the db and it should go through now. --> Okay. --> Just create index, but I just created index. --> That's weird. --> Um, see. --> Control R create index. --> Okay. --> This is the same way that I did it. --> Oh, okay. --> Now I know it's on books, not on library. --> We should be good now. --> And then if we try and do that, --> it should show us what we want to see. --> There we are. --> So it's not showing us what's in the secondary. --> So what needs to be changed is indexing. --> I need to add indexing. --> I also need to add the rs dot add stuff to be able to edit the secondary one. --> And then, yeah, for the rest, I think it should be good. --> Just be mindful that with this one, --> you will need to create the directories first. --> So the same way you did on that. --> I'll add that stuff so that it's step by step. --> Then you need to add the directories first and then run the replica set. --> This one automatically has one name replica, right? --> It's one replica name. --> So automatically this one will be the primary --> and this one will be the secondary. --> This is true, right? --> And then you create the replica set and then insert documents into that. --> And then you should be able to check this using MongoS. --> So you should be good to go. --> Yeah. --> And I think the rest should work out fine. --> Yeah. --> But I'm going to add the stuff today. --> So later on when you have time, then you should be able to work on it. --> Okay, cool. --> So I think and then you can then do exercise two, exercise day two. --> Whatever time you can be able to do it says to the installation. --> You don't need to do it, but you need to create the hospital authentication. --> You can do it and then you can do some indexing. --> You can do some right replicate replica sets --> and then you can do some backup and restore. --> It should be simple. --> Exercise should be simple. --> So you're saying we can do exercise one exercise. --> Is it day two or day one day? --> Day two. --> Day two. --> Yes. --> And we can. --> Sorry, it's Ivan. --> So we can skip the creation of the hospital. --> No, no, no. --> Don't skip the creation. --> This is a completely new creation altogether. --> What you skip is the installation because it starts off. --> Installation of MongoDB or the DB. --> Yes. --> And then you don't really need to do it because you already have it. --> Right. --> And then you start from create the hospital. --> Oh, okay. --> Yeah, cool. --> Thanks. --> Sorry, Cumberland. --> Yes. --> I think it's complaining that it's not primary. --> Who is that? --> Is it Ivan? --> Yeah, it's Ivan. --> Okay. --> Let's have a look. --> It's hospital, switch to DB hospital. --> That's that's that. --> Not primary. --> Why should it complain that it's not primary? --> It's just supposed to add a DB and that's it. --> It doesn't, it doesn't need. --> Wait. --> Let me check something. --> Not right. --> Right. --> Table. --> Primary. --> Mongo server error. --> Is it because of the shards? --> What number are you busy with? --> Exercise day two, the day two, the one at the bottom, but on the. --> Yeah. --> No, no. --> Which one on? --> Oh, you skip the first part of creating the DB. --> So this one is the creating the hospital database. --> Okay. --> So what's happening is remember there's the replicas that you created, right? --> And when you just log in as Mongo SH, right? --> It's it, it logs in, but it's not the primary that you need to be using. --> So you need to use it. --> Remember we created the Mongo SH that was important. --> Twenty seven zero zero two four, which had a secondary. --> That's where it's set as primary. --> So you can be able to, to run it on those ones, not on the normal Mongo, --> something, something if that makes sense. --> So the normal, the normal Mongo is no more a primary, --> but we've got one that we set as the primary, which is the twenty seven or two four. --> Then you can be able to run your stuff on it. --> And then you can do the optimization replication. --> You might not really need to do this replica set part. --> It's up to you. --> You can do it, but you can still do using this replica. --> What do you call this? --> That is there already. --> You still can be able to do this. --> You still can be able to just use the same database. --> So it's up to you, but let me to make it easy. --> Let me change this. --> To two seven zero two four. --> No, no. --> The reason I was asking is because I went past that and didn't have any issues. --> Yeah. --> Yeah. --> So twenty seven zero two. --> You didn't have issues. --> Who is that? --> Who is who's speaking now? --> A corner. --> A corner is your replica. --> Is your is your replication replica set working? --> Does it have a secondary? --> Oh, no, I left that. --> They said must be like like he and skip problems. --> No, that's fine. --> No problem. --> So then it would work because you don't have a replica set that's running. --> But I'm going to add I'm going to top up on the documentation currently --> to be able to add a secondary onto it. --> And then also how to remove the replicas, how to switch off the replicas to shut them down. --> Did someone take over my screen? --> Yes. --> Are you back now? --> No, I've been back for a while now. --> Oh, is it when I was when I was assisting Winnie, where were you? --> No, when Winnie said she's been at quarter past three. --> Oh, you were there. --> Oh, okay. --> I agree. --> You know, she's the lady. --> She was leaving. --> You said, no, insensitive mailing is not here. --> I'll help you Winnie. --> Let's share. --> At least, you know, my friend, I was doing the right thing. --> You and I've been with exercise day two. --> Yes. --> Four point four. --> Yes. --> The rerunning. --> Yes. --> You're not running it in. --> You're not running it in in what you call this in a database. --> Your database failed to log in. --> Did you realize that? --> No. --> Where did it feel here? --> Let me highlight the I thought it was nice and colorful. --> I thought it's weird. --> It confuses. --> Right. --> It shows you that connection string. --> But also after that, it doesn't log in like it's just weird. --> So your very first thing is you need to be able to log in first. --> Put at dash dash port two seven zero two four. --> Must add it to it. --> Mongo. --> S.H. --> Yes. --> Space. --> Port two seven zero two four. --> That's primary for that thingy. --> She didn't spell Mongo, right? --> It's the end of the day. --> It's understand they are. --> So now you can you can create that database. --> Create that database first. --> Go up first and then create the this database. --> Yeah. --> Why do I create that? --> That you did you create it? --> Enter. --> Okay, cool. --> Now you can go down. --> Okay. --> And then it was a retaining of 5,000. --> I'm telling you, that was created. --> But now you see I'm questioning myself as well. --> I want to see something. --> See here. --> So the retaining this 5,000. --> So I'm wondering why. --> Is hospital. --> And it actually had added. --> Yeah, that's interesting. --> And then I had to also I've also added the authorization. --> Well, you can add it. --> But for for quicker way, if you want to troubleshoot --> and spend time troubleshooting, then you can do that. --> But what you can also do is do the rest of the stuff --> and then come back to authorization. --> Then you can be checking to are you logged in? --> Can you see collections? --> Can you check your indexes and whatnot? --> If that makes sense. --> For now, I'm moving my authorization. --> Yeah, you can remove it and do the rest of the work. --> And then when you are done, then you edit --> so that you can then come back. --> And when you can authorize, you can put back authorization. --> Now you only need to take your stuff like checking of indexes. --> Do you know if the documents checking that like you are doing now, --> checking the status of your shards and stuff. --> Skip that and then go to creating of indexes. --> But remember which MongoDB are looking in. --> Logging into the one that's got 27024. --> You should remember that. --> Remember, we created that's where you added the database last. --> So you can add that into it. --> I'm not going to forget. --> I've got a lot of problems that I have in my head. --> OK, do MongoSH. --> Maybe because your application, you didn't have a secondary. --> It should be able to work. --> OK, it won't work. --> So it makes sense. --> So use the one that's got 27024 MongoSH and then use. --> What is it? --> Is it a hospital? --> The database name? --> Yes, it's hospital. --> Yeah. --> So you can do use hospital and then you can run the rest of the stuff. --> Is hospital. --> Yeah, so you can go down, run the rest of the stuff. --> You might not really need to initialize that. --> It doesn't like, I don't think. --> So number one, you've got a replica set already, right? --> You're already in the, if you look at your terminal, --> you're already in the primary. --> So you don't really need to initialize a new replica set. --> For practice purposes, it's up to you. --> But what you can actually do is actually go and do the insert with the right concern --> because already you've got a replica that you're in already, if that makes sense. --> So you can just go to that and then you do your rs.status. --> rs.status. --> And then brackets. --> Oh, you wait for me to finish first. --> You rush to place it. --> So rs.status and then brackets at the end. --> Yeah, the rs dot should not, there shouldn't be any space there. --> Yeah. --> Then you run that and then you've got your secondary there --> and then just go up a bit. --> Then you've got your primary there should be good. --> Any election. --> So it's got a whole lot of details that you can read through. --> But yeah, everything should be good. --> And then you're good to go. --> Then you'll back up and restore. --> Just just to make sure that what you call this. --> You you're outside the database. --> That's number one. --> Yes. --> And then number two, because you don't have authentication enabled, --> you can remove the part where it's from minus you --> to up until where it says admin on the yes. --> Right. --> So that whole part you don't need. --> So exit, exit, exit. --> Yeah. --> Exit the database first. --> Then I'll show you what I'm talking about. --> Right. --> And then copy the first backup, the MongoDB. --> Mongo dump. --> Sorry. --> Yeah. --> And then paste that, but don't press enter yet, --> because you're going to remove some stuff. --> So from where it says admin. --> The last yes. --> I did admin one, two, three. --> No, no, no. --> So we want to remove the whole part that deals with authentication. --> Right. --> So remove that part up until minus you. --> But yes, remove that up until admin. --> And then remove the other parts. --> Yes. --> No, no, no. --> No, no, no. --> The other side. --> So that's one, two, three. --> So up until where it says minus you, --> remove up until where it says minus you. --> Because you don't need any authentication. --> Continue again, remove minus you. --> And then do dash, dash port space two seven zero two four. --> Seven zero. --> Two four. --> Remember, that's where your database is sitting. --> Two seven zero two four. --> Seven zero two four. --> Yeah, I think you should be good to go. --> Two seven zero two four. --> Did we, the last time, did we add equals? --> No, no, no, we didn't. --> So you can press enter. --> I said, click on the terminal and then present. --> Okay. --> It is dumped it right, which is fine. --> Right. --> What you need to do is log into the database and then delete patients. --> Right. --> So, um, mongo s h space minus minus dash. --> I mean, it's the port two seven zero two four. --> Enter. --> And then use use hospital. --> And then, uh, db patients dot delete many. --> So you're deleting everything in patients. --> Right. --> Deleted. --> It has deleted five thousand. --> Right. --> Um, then do db dot patients dot find. --> And then in brackets, the patients dot find and then brackets. --> The closing bracket. --> Enter. --> So it's empty now. --> Right. --> And now exit the database. --> Now you need to run the restore without the authentication part. --> Yes. --> So instead of doing that, do the app arrow. --> Just go on the terminal, click on the terminal to app arrow. --> Yes. --> Change that mongo dump to mongo restore. --> It's the same thing. --> Then do restore. --> Yeah. --> And then press enter. --> Right. --> Uh, mongo restore. --> Okay. --> What's happening? --> Oh, is it an, is it in dash dash hospital dash backup hospital? --> Okay. --> Oh, okay. --> Sorry. --> Um, do app arrow. --> Do app arrow. --> Yes. --> And then remove the dash dash out. --> Mm-hmm. --> And then after backup type hospital, forward slash hospital. --> Enter. --> Successfully restored. --> And then you can log back in. --> Uh, you need that port. --> Don't forget that port. --> Yeah. --> And then use hospital. --> And then, uh, just do app arrow. --> Yeah. --> There you are. --> The information is back and restored. --> Hospital database, create that, and replicate right concerned. --> Okay. --> And you should be good to go. --> It says complete. --> So, um, some troubleshooting scenarios. --> That's not really much of, of things that thingy. --> No, no, I, I hope everyone was keeping up. --> Are they still there? --> That's the question. --> Yeah. --> No, like he has been too quiet. --> No, but they can still do it later on. --> Um, you, you sound very far from your laptop. --> I'm like, ah, I am here. --> I told you after lunch, I keep quiet. --> You kind of have at lunch. --> Like that's a corner. --> Oh, yes. --> He eats lunch. --> It's it's puppet lunchtime. --> Yeah. --> Not only lunch, even breakfast. --> So that is a truly important. --> Where is he from? --> Is he vendor? --> Yes. --> That's why we can keep saying, um, mango DB thinking mango is that one. --> Yeah, no, that's fine. --> Um, so yeah, that's, that's all from my side. --> Uh, anyone else would need help. --> I'm still here, but for you, it's all good. --> I'm going to update some stuff on the documentation today. --> And then you still have access to your virtual machines. --> You still have access to the repo. --> If you want to pull it, you can pull it. --> Um, and then use it at any other time that you want. --> We've got access to visual machines until when? --> Um, did you make it and to enable to have it after the course? --> Uh, I don't know. --> Okay. --> Share your screen because this, I can't show you from my side from, from my screen. --> I'll show you a screen. --> Then everyone else can be able to see. --> I must share the whole screen. --> We just need where you've got your daddy's talk. --> There's a lot going on on my screen. --> Go on the other tab there. --> You see where it says it will go on the tab that says MongoDB on top there. --> On your laptop, not in the virtual machine. --> Yes, go there. --> Okay. --> You ticked where it says enabled. --> You see where it says enabled. --> Go on the eye on the eye. --> No, no, no, not that on the eye. --> Yes. --> So it just means that after the course, then it will be moved to your course desktop. --> Use desktop after course finishes. --> So in essence, it will then move it there. --> But go back onto that tab. --> Onto the tab. --> So go up that page. --> So usually it would go do home. --> Just click home. --> Desktops. --> Let's go to desktops. --> Oh, where is, where doesn't it show you standalone? --> Go down. --> Ah, it's because I'm married. --> Click the, the, that, uh, down arrow where there's the wheel, where there's the wheel. --> Yeah. --> And then go to where it says clone move. --> That's another option. --> And then clone to standalone desktop. --> And then it will create a standalone desktop. --> Um, it's up to you. --> You can wait till the course ends later on today and then clone it. --> And then it should go to where it says stands alone desktop. --> Let me, let me take over your screen quickly. --> Maybe, um, --> my screen, what screen do I want? --> The desktop, okay. --> I want the screen, the one with the desktop. --> Okay, let me just do this. --> Let me know when you can see my screen. --> Yeah, I can see that. --> Yeah. --> So usually to then show you courses, course, desktops, and then stand alone. --> So if you go to your stand alone, then no matter right now, --> we are looking at your calendar and the time. --> Hey, but let's say the whole screens. --> At least it's not something that's not right. --> Yeah, no, some of us are underage. --> Um, desktop machines, stand alone, the desktop. --> And now. --> Yes. --> Stand alone. --> Yeah. --> So usually it would come here after the course is done. --> And then when you see this, this, yeah, yeah. --> So when, when you're done every course, you get a credit of 50 pounds. --> As far as I know. --> Well, I don't know if it's just the trainer side or even you guys get it, --> but, um, usually I get 50 pounds is, is a, you've completed a course type of thing. --> So I'm not sure if participants get the same. --> But then what do you do with them? --> You, you can start another server. --> You can start another class. --> You can create a new course, but it finishes very, very quickly. --> That's something that you can't withdraw it if you're looking for that. --> Yeah, no. --> You can't withdraw it. --> That's the, that's the annoying part about it. --> If I, if, if it was with drawable AI, I would have had so many words. --> So much money. --> But anyway, yeah, that's the story. --> All right. --> Thank you very much. --> All right. --> Thank you guys. --> Thank you so much. --> Um, sorry, is it possible to get to this, um, information, this GitHub information? --> Yes, you can. --> You can actually have it. --> Uh, let me send you the URL. --> Okay. --> You see it. --> Oh, I'm here. --> At least I did something. --> Wow. --> Like this is what you are all doing. --> Like this. --> Yeah, get the hub.com. --> Come on. --> Anything for, for there's also stuff for developers though. --> Um, so this is MongoDB for admins. --> There was a time that I trade for developers. --> So if you go into that report, you should be able to see them. --> So if you go here and then, so there's MongoDB for administrators. --> And then, uh, then there is MongoDB for developers. --> And Kubernetes trainer. --> Yeah. --> CKE administrators, uh, and then, yeah, then there's Kubernetes, Kubernetes in itself. --> Some of the stuff, it was just my personal stuff that I was working on. --> But when it's training, for example, CKE, this is training, uh, intro to Azure --> and the AKS training, Google cloud is training, uh, WSO2 API manager, --> MongoDB, Oracle, Oracle, I don't think it's got anything. --> This Oracle is a best in itself, but Linux admin, --> Docker and Kubernetes training performance and all that stuff. --> And then supersets. --> If you want to do what you call this, um, big data. --> Superset is one very good one. --> Um, yeah. --> All right, cool. --> Cheers, man. --> Yes. --> Yeah, it's Ivan. --> I think I'm also, uh, call it a day, but just from my side, --> I think I just want to thank you, man, for the training and the exercises. --> Uh, but, uh, when I know, um, would you be doing any of the --> trainings that we still left with? --> Um, which ones I'm not sure what training you guys have. --> Yeah. --> I think there was, if I'm not mistaken, there was the Linux command line. --> Yeah. --> Uh, hold on. --> Let me tell you which ones I have. --> Um, but if it's Linux, I think definitely I'm going to be doing that. --> Uh, let me just see, let's see the documents here. --> So, um, MongoDB and then, uh, I'll need to look for the schedule, --> but I know that I've got, uh, some classes in, uh, so this is in February. --> I'm not sure if I'm doing DevOps foundation with you guys. --> Oh, wait, there was foundation in March. --> Okay. --> And then there's capstone project. --> There's Linux commands and then there's intro to DevOps principle. --> No, that's not you guys, but there's DevOps foundation in March. --> Yes, definitely. --> We're going to be doing together. --> Oh, and then Docker, Docker and Kubernetes. --> I've given you answers now. --> One of 30 points for that course. --> Yeah. --> Yeah. --> So yes, we're going to be doing that. --> No, cool. --> Uh, guess we'll meet then then. --> All right. --> Cool. --> No problem. --> Bye. --> Winnie, are you still here? --> Yeah, I'm joined with my phone. --> Oh, okay. --> No, you can, you can, you can jump off now. --> I think we're good. --> Okay. --> Thank you. --> All right. --> Cheers. --> Yeah. --> Uh, okay. --> Oh, okay. --> That's fine. --> Let's also. --> Oh --> Oh --> Oh --> Yes, no, I'm busy I didn't call you --> Know I'm busy --> Oh --> Oh --> Oh --> Oh --> Oh --> Oh --> Plan to wait with our three month lay by --> Oh --> Ever worry about your puff not be --> I --> Love it for Nazi --> Serious today stars and your bank --> If you --> This isn't a scared tactic it's the law --> Remember I say legal and a lie --> William can you send a message to anyone who's cheating in a relationship in south africa right now? --> And tell them what --> Don't include me --> Just watch my content and just like and comment, but if you're cheating it's up to you --> Use protection, man --> So --> This is just so sad. --> This is just so sad. --> This is just so sad. --> This is just so sad. --> This is just so sad. --> This is just so sad. --> How comfortable are you with your significant other challenge? --> Put a finger down if you've ever used their toothbrush. --> Put a finger down if you've ever peed in front of them. --> Put a finger down if you've ever squeezed a pencil on them. --> Put a finger down if you've ever pooped in front of them. --> Put a finger down if you've ever been in the room while they wiped. --> Put a finger down if you've ever tried to dutch oven your significant other. --> How comfortable are you with your significant other? --> This is just so sad. --> This is just so sad. --> Know that you're sitting tough. --> Number two, we're at the tough. --> Want to see your crush kiss you? --> One for tonight. --> Yeah, yeah, yeah, yeah. --> Beyonce said if you like it, --> Beyonce said if you like it, --> Beyonce said if you like it, then you should have put a ring --> then you should have put a ring --> Beyonce said if you like it, then you should have put a ring --> Beyonce said if you like it, then you should have put a ring --> I was like, I was getting so mad. --> He was like, stop it. --> Old Joey would be like, what? --> I just want this choice. --> Old Joey would say, what is up with the boot in between? --> I was like, put the hazards on. --> Don't be a liar. --> I was like, five seconds away. --> I was trying to get the boot on. --> I'm distracted. --> Show them exactly what you just showed me. --> Okay. --> One of those websites called Landing Site AI. --> Make a new website. --> All you do is just type in the name of your business. --> And then you put in a few sentences about what you want the website to look like. --> And make your website. --> Wait two minutes. --> And there you have it. --> A customized website ready for you in two minutes. --> You can go and change any of the images, the text. --> There's even an AI bot that you can use. --> Cape Town the 27th of January 25. --> Much respect to this taxi driver. --> Go. --> When she didn't give you no action last night. --> She's just gonna show me her face, come on. --> Show your face! --> Can you switch them out? --> Fuck, bite themselves and they're nervous. --> You made me nervous! --> You made me nervous! --> You know how many... --> You know how many... --> You know how many... --> You know how many... --> You know how many... --> You know how many... --> You know how many... --> I have clients that want me to fuck them in the ass. --> I have clients that want me to fuck them in the ass. --> I have clients that want me to fuck them in the ass. --> I have clients that want me to fuck them in the ass. --> I have clients that want me to fuck them in the ass. --> I have clients that want me to fuck them in the ass. --> I have clients that want me to fuck them in the ass. --> I have clients that want me to fuck them in the ass. --> I --> Know --> I --> Could never --> I --> Oh --> I --> I --> I --> I --> I --> You