ALine

Creating a dual Server

Recommended Posts

Hey, ok so I am working on a new project and I was wondering how would I go about connecting 2 servers together. Like each server is it's own independent file/document server and the 2 servers can connect to one another via some link. 

The reason that I would be having 2 separate servers instead of just a single server and connecting 2 devices to it is that I want the person using the server to have absolute control of there documents and files all while allowing for each server to copy information from each other. Also if one server were to die or be destroyed then another server would just have everything backed up on it.

Maybe it would be better if I explained it with a picture.

 

image.png.98525b543146bb35e6b88c746222abde.png

 

 

Share this post


Link to post
Share on other sites

That already exists and sounds like a good homework project for you. Why don't you try making an ftp client and server with a javafx frontend and post how you get on with it. Feel free to ask me any questions.

Share this post


Link to post
Share on other sites

So let me know how you get on with the following tasks,

Assignment 1:

Part 1: Install java 10  http://www.oracle.com/technetwork/java/javase/downloads/index.html since it is the java version I am using right now and intellij idea it is the ide that I use https://www.jetbrains.com/idea/download

Part 2: Create a java class to watch a directory for changes. To do so you will need to use https://docs.oracle.com/javase/tutorial/essential/io/notification.html

Part 3: Install MySQL Workbench https://www.mysql.com/products/workbench/

Part 4: Create a new database with a table containing just a Date column and an Event column in MySQL Workbench

Part 5: Create a java class to make a MySQL database connection following https://www.tutorialspoint.com/jdbc/jdbc-sample-code.htm

Part 6: Create a java class to keep track of the events from part 1 and save the changes to the database using the MySQL class you just created.

Part 7: Create a .jar file from your java classes https://stackoverflow.com/questions/2025607/how-to-create-a-jar-file-or-export-jar-on-intellij-like-eclipse-java-archive-e

Part 8: Create a .bat file to run the jar file you just created https://stackoverflow.com/questions/5774970/run-jar-file-in-command-prompt

Part 9: Create a scheduled task to run your .bat file https://stackoverflow.com/questions/17438482/set-task-to-run-on-system-startup-schtasks-command-line

Part 10: Restart your computer. Check that the task is running and delete the scheduled task from task scheduler

Share this post


Link to post
Share on other sites

Now I am trying to make each server portable using a raspberry pi 2. Also, I will be getting it within 1 weeks. I will tell you about my progress.

Share this post


Link to post
Share on other sites
Posted (edited)

While mirroring there is needed synchronization mechanism, which will prevent change of data, when archiving is in progress.

When file size is small, or database is just few MB, chance for user to accidentally access website which is the middle of mirroring is pretty low.

The larger amount of data, and the more often it's done, the chances grow.

Typical mirroring is done once per day, in time, when server is the less frequently visited (which depends who is the largest user of server, typically at 4 at night local time *).

*) There is always place on the Earth where is 4 at night for somebody...

 

Edited by Sensei

Share this post


Link to post
Share on other sites
Posted (edited)

Oh no the server is not for connecting clients to, well not really, it will only be accessed by on server of the other server. So there would not be any clients besides the 2 servers. I just want to have the option for there to be clients. 

Edited by ALine

Share this post


Link to post
Share on other sites
2 hours ago, ALine said:

Now I am trying to make each server portable using a raspberry pi 2. Also, I will be getting it within 1 weeks. I will tell you about my progress.

In which case you can ignore all the stuff about Java and just use Python. Much simpler. 

If all you want to do is keep the documents synchronised between the two servers then the command rsync may be all you need (it has dozens of options for different ways you might want to use it, do I won’t attempt make any suggestions at this point). I use it to keep a backup of all my files on a server. 

You can run it at regular intervals (eg using corn). 

Share this post


Link to post
Share on other sites

Strange just came in out of left feild with that python save. Thanks I will try both and use java as a learning exersise.

Share this post


Link to post
Share on other sites

Ok so my raspberry pi and Arduino just came in yesterday and I decided to combine the 2 together into a single "raspberry pi / Arduino" sandwich with a 128 GB SSD sandwiched directly in between the two. I also got a wireless handheld keyboard but it came in the mail broken so I am returning it tomorrow to get a new one. This will allow me to make Arduino programs and send them directly to the Arduino on the other side in order to do fun stuff like programming and building things on the go.

Share this post


Link to post
Share on other sites

Soo update. I have gone through 3 iterations of the device, trying to improve form because there is only so much I can do to make it run faster besides overclocking it. However, right now I am having an overheating issue so that would break probably melt the battery because it is right underneath the raspberry pi. I am up for suggestions on how I can improve it. From hardware attachments to software add-ons. I still have not done the server connecting thing because I have to have another device to send the files over to. Plus I want to get everything organized first before sending files over from one server to the next.20180804_124721.thumb.jpg.b89e5f5e7e51734921a6d1a2269dca0d.jpg

Share this post


Link to post
Share on other sites

ok so since the last update I have gone through 2 versions. I am not able to get images up because I cannot find my phone. So for the newest version, I removed the Arduino Uno from the build entirely for the time being until I can incorporate an idea which involves using a microcontroller control network. So far I have been using Dropbox as a server between 2 of these devices however that got full so now I am switching to one drive which I am almost done doing. I have successfully been able to map a drive, that being the raspberry pi, to a laptop using samba. Next, I am going to link that raspberry pi to another raspberry pi, however, I just need to get the other raspberry pi first. So yeah that's my update. See ya.

Share this post


Link to post
Share on other sites

Thinking about getting a Micro atx board and making this bad boy a portable gaming tablet with Nvidia graphics card and Intel i7 core processor.

Edited by ALine

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now