How do i remotely update a mongodb, when i dont have a public ip for my pc? - mongodb

I have a raspberrypi which has a 3g modem attached to it. I run a mongodb instance on the raspberrypi. How do i remotely connect to the instance and run update queries? The public ip of the modem keeps changing. I use bitsync for managing files in the same scenario.

Use a dynamic DNS service so your pi has a public internet host name. A quick search for dynamic dns turned up dnsdynamic.org (which I have never used and have no association with) which claims to be a free service. You will have to run a little app on the pi to update the dns record using e.g. The perl client they have. They seem to have several domains you can use and also seem to provide domain hosting so you could use your own domain name with them. I'm sure there are other dynamic dns services out there with simular offerings.

Related

Automatically update a domain with an IP address

Over the years, I used No-IP to link a domain to my IP address, and then used No-IP's DUC (Dynamic Update Client) to update my IP, so that the domain will always point to my IP.
That's very handy for running dedicated game servers.
Is there a DUC-equivalent for Google Cloud DNS?
In essence - No - there isn't :(
Unless yo're using Google Domains for your domain hosting then yes - they support just the thing.
Cloud DNS doesn't have that functionality. There are several workarounds like reserving a public IP for your VM which in my opinion would be the best way to do it. Unless your VM get's deployed using Deployment Manager then it may require some more scripting.
Similar questions have been raised on Stackoverflow here and here which you might find helpful.
If you're running Linux here you'll find a complete script how to update DNS records after a machine startup.

Static Way to Access a Remote Machine

There's an application. This application is run on several different client devices and it makes use of a server: that is, each of those instances of the application may connect to a server, said server being a certain remote machine that is constantly listening for incoming connections, at which point the client machine and the server machine communicate following a certain protocol.
Now, this is all nice and easy as long as I'm testing within one LAN managed by one router. I can simply set the server machine to have a static IP address and this address will just be hardcoded into the application so that every instance of it will be able to directly communicate with the server endpoint. But what I'm not sure about is what I'd do if this application was intended to run outside the limits of a single LAN with private IP addresses.
Basically, my question is what approach should I choose in order to have a static way to access a specific remote machine.
Is there any static public address that can be used to reach it? Or should I purchase a domain name and have it respond to requests from clients with the server machine's current public IP address? Or should I go on and purchase a static external IP address? Or am I simply not thinking about this the right way, and the solution should be approached from an entirely different direction?

Can I force Eureka registrations to use an ip address instead of a hostname?

I have a standalone, embedded Eureka server powered by Spring Boot 1.2.0.RELEASE and Spring Cloud 1.0.0.RC1. I see services properly registering themselves in the dashboard, which is great. The status links are using the host name of the box they are running on. Unfortunately, we are using virtual machines and they don't register themselves in DNS, which means that the links are unresolvable. I started looking through the code but was unable to find a way to force the links to use the host's ip address instead. Having a broken dashboard is not the end of the world but I am afraid that once we start using Ribbon or Feign to contact services, those URLs will also use the host name and be unresolvable. Maybe what I am really asking is there a way to force the clients to register with an ip address instead of a host name? Any help is appreciated.
set eureka.instance.preferIpAddress=true as documented here

How to make Windows DNS and WINS settings persist in an Azure VM?

I have a domain controller set up in an Azure VM, and a couple of other servers also set up as VMs. When I set up the server VMs, I configured DNS and WINS to point to the IP address of the DC and joined them to the domain. However, these settings don't survive a shutdown (where the VM is deallocated). When the VM is started back up, DNS and WINS are empty, and domain authentication does not work.
I read that I should provision new VMs via PowerShell commandlets, specifically setting up domain joining. I tried that, and maybe I got something wrong, but it didn't work -- the newly provisioned VM was not joined to the domain, and did not have DNS/WINS set to point to the domain controller.
In any event, my question is: is there any way to re-configure an existing VM to retain network settings through a shutdown or is my only option to figure out how to provision a brand new VM to be married to the domain controller, and then to start from scratch?
Thanks!
You shall never use static configuration on your Azure VM! Neither for IP Addresses, nor for DNS Settings. What I recommend to use is a long story you can read here. It is tested, validated and proven to be effective. A short extract follows:
You should setup at least two sub-nets. Leave one solely for the DNS (and AD/DC if it happens to be the same server). Put all rest of the machines in the other Sub-Net. Thus, you will have 100% predictable IP Address of the DNS Server machine. Having that in mind, configure the DNS for the virtual network via the portal or via PowerShell. But explicitly configure DNS Server for that virtual network. Set IP address for the DNS - the one that you know it will have!
Please do never forget - never manually change network configuration settings for an Azure VM! Doing so is a path to failure.
The above method will help you resolve DNS issue. Now, for the WINS. I don't think you can configure WINS via Virtual Network settings. So, if your VM really loses WINS config, you can create a small powershell script that runs locally on each VM to configure WINS settings upon boot. You can either make this script more generic by looking up the DHCP assigned DNS server and use the same IP Address for WINS, or just put it static, because you know what the IP Address of DNS server will be.
Anton presents a clever and perfectly workable solution, but I wanted to understand what exactly I was doing wrong, because Microsoft guidance suggests that it should be perfectly possible to set up and maintain an Active Directory domain the in the Azure cloud without putting the DC into its own subnet.
After a lot of trial and error (mostly error), I finally figure it out. This is not well documented, so hopefully this will help someone:
In Windows Azure, cloud service is another term for application, or a set of components that scale together. A cloud service is assigned a single DNS name and a single external IP address. In the context of virtual machines, you typically have a 1:1 correspondence between a cloud service and a virtual machine. You only add additional virtual machines to an existing cloud service when you want Azure to automatically load balance and distribute requests among the VMs inside that cloud service, treating them as if they were one.
This brings me to my mistake. Not fully understanding the above, I was attempting to add a new worker virtual machine to the cloud service in which I set up my Domain Controller. That is not a supported configuration. Once I understood that, and properly configured a new VM into its own cloud service, associated with the domain controller as DNS server, everything worked perfectly.

how to setup web server,application server,db server on multiple vm?

I would like to do my study practice.
To install the multiservers seperating on multiple vm -web server in first vm ,app server in second and db server in the last vm .then,I will create my own webpage to test about accessing data in db .Each of vm is based on VMware in my computer and just do it on localhost environment.not need to connect internet.
How can I do this or Where can I find any Tutorial .Plese give me some suggestion to finish my project ^^"
Thank u very muchh
Just like what you do in physical machines. And IMHO, your question is too general and has nothing to do with virtual machines. I think what you are looking for is how to setup a web server and how to use a database. Why not check the sites such as nginx or apache and mysql or postgresql ?
First of all you need to run all the machines and connected with each other.
By doing this you'll get IP addresses of those machines..
Now simply replace your IP addresses with localhost according to server
Note that every machine must have an appropriate server