how to push file to another server

8 views
Skip to first unread message

Mahabub Basha

unread,
Aug 22, 2007, 1:38:16 AM8/22/07
to cherryp...@googlegroups.com
Hi

I am the fan of Cherrypy. I am running CP 2.2.0 beta. I am running two cherrypy servers on two machines which is connected to LAN.

one is master server and another one is backup server. Whatever changes updated in master should be updated in backup server also.

For example I am storing the form data in dictionary. The dictionary should serialized as pickle.

I have to push the pickle file to my backup server whatever changes made in form data.

my master server running on 172.16.1.1

my backup server running on 172.16.1.2


I am access the web server interface using this above ip's in browser.

How can i push the pickle file to my backup server.

please help me to solve this. Anybody have documentation about this or example. please send it.

Thanks in advance

- Basha.S

Scott Chapman

unread,
Aug 22, 2007, 9:19:53 PM8/22/07
to cherryp...@googlegroups.com
This is not CherryPy specific, I don't think.

This sounds like syncronizing files in the file system, so rsync should
do the trick.
http://everythinglinux.org/rsync/

Google is your friend.

Scott

Mahabub Basha wrote:
> Hi
>
> I am the fan of Cherrypy. I am running CP 2.2.0 beta. I am running two
> cherrypy servers on two machines which is connected to LAN.
>
> one is master server and another one is backup server. Whatever
> changes updated in master should be updated in backup server also.
>
> For example I am storing the form data in dictionary. The dictionary
> should serialized as pickle.
>
> I have to push the pickle file to my backup server whatever changes
> made in form data.
>

> my master server running on 172.16.1.1 <http://172.16.1.1>
>
> my backup server running on 172.16.1.2 <http://172.16.1.2>

Mahabub Basha

unread,
Aug 23, 2007, 12:01:28 AM8/23/07
to cherryp...@googlegroups.com
Hi

I have googled before i posted to cherrypy groups.

I want to implement this by making use of an cherrypy. I have tried to use cherrypy.request.remote_ip.

I didn't get  what i am expected. Then only i posted to cherrypy groups.

Anyway thanks for your kind reply.

- Basha.S


Eric Larson

unread,
Aug 23, 2007, 2:55:22 AM8/23/07
to cherryp...@googlegroups.com
Hi,

I think the idea is that other libraries used in conjunction with
CherryPy would be beneficial. For example, if you take a POST request
to your CherryPy app, you could load the data from it and send it to
another application via a HTTP request using something like httplib2.

While I am not sure of the CherryPy specifics, you can read from a
file like object in the WSGI environ dict using the 'wsgi.input' key
when you are trying to accept the POST'd data as a file (as opposed to
variables).

The CherryPy Essentials book discusses this in its discussion of
RESTful protocols. It is worth the $25 to have a PDF version (IMHO).

I realize this all might be a bit vague or unclear but hopefully, it
can give you a few ideas of terms to google :)

Eric

PS Often times the answer is very easy to find on google, yet the
terms are difficult to pin down. Good luck!

>
> - Basha.S
>
>
>
> >
>

Alberto José Rubert Escuder

unread,
Aug 23, 2007, 6:31:26 AM8/23/07
to cherryp...@googlegroups.com
Mahabub Basha escribió:

> Hi
>
> I am the fan of Cherrypy. I am running CP 2.2.0 beta. I am running two
> cherrypy servers on two machines which is connected to LAN.
>
> one is master server and another one is backup server. Whatever
> changes updated in master should be updated in backup server also.
>
> For example I am storing the form data in dictionary. The dictionary
> should serialized as pickle.
>
> I have to push the pickle file to my backup server whatever changes
> made in form data.
>
> my master server running on 172.16.1.1 <http://172.16.1.1>
>
> my backup server running on 172.16.1.2 <http://172.16.1.2>

>
>
> I am access the web server interface using this above ip's in browser.
>
> How can i push the pickle file to my backup server.
I think the better way is to create a conection (TCP or UDP, as you want
but to send files i sugest UDP ) with sockets between the two PC's, i
know this is possible with C, C++, Java, and others with thier
respectives libraries but i have not test it never with the python
sockets library (however i'm supre python has a library like *socket *or
somethink wich is able to do it). Probably the problem is you need a
specific port to do the job and a daemon running (listening to that
specific port) at the server wich will receive the file.

Sylvain Hellegouarch

unread,
Aug 23, 2007, 6:47:24 AM8/23/07
to cherryp...@googlegroups.com
Recently I've implemented a queue system [1] based on Kamaelia [2] and
memcached or Amazon SQS.

Basically your application would open a connection to a queue server and
send a queue message which payload can be whatever. The queue server
will use either memcached or SQS to store the queue message.

Then other applications can read from the queue and fetch a queue
message to process it. A message can also be deleted of course.

The point is to avoid that your main application has to wait for your
other applications to process whatever data the main application generates.

Instead you decentralize the work in a nice and scalable way. You may
get inspiration :)

- Sylvain

[1] http://trac.defuze.org/wiki/bucker
[2] http://kamaelia.sourceforge.net/Home

Alberto José Rubert Escuder a écrit :

Tim Roberts

unread,
Aug 23, 2007, 1:15:41 PM8/23/07
to cherryp...@googlegroups.com
Alberto José Rubert Escuder wrote:

I think the better way is to create a conection (TCP or UDP, as you want 
but to send files i sugest UDP )...

Really?  Why?  With TCP, I don't have to worry about packet sequencing, and the network takes care of error retries.  UDP transmissions are not guaranteed to arrive, and when they do arrive they aren't guaranteed to be in order.

UDP has its place, but for file transmission I would always go with TCP.  I'm just curious to know why you would propose UDP.
-- 
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Alberto José Rubert Escuder

unread,
Aug 23, 2007, 1:26:03 PM8/23/07
to cherryp...@googlegroups.com
Tim Roberts escribió:

> Alberto José Rubert Escuder wrote:
>>
>> I think the better way is to create a conection (TCP or UDP, as you want
>> but to send files i sugest UDP )...
>
> Really? Why? With TCP, I don't have to worry about packet
> sequencing, and the network takes care of error retries. UDP
> transmissions are not guaranteed to arrive, and when they do arrive
> they aren't guaranteed to be in order.
>
> UDP has its place, but for file transmission I would always go with
> TCP. I'm just curious to know why you would propose UDP.
You are completely right. I was wrong. Sorry. I though in the same LAN
UDP would be more quikly than TCP, however all you said is correct.

Mahabub Basha

unread,
Aug 28, 2007, 2:30:20 AM8/28/07
to cherryp...@googlegroups.com
Hi all,

I have solved my problem.

I am implemented this using urllib module.

I pickle the form data and I posted the data in HTTP.

Its working fine.

Thanks to all.

- Basha.S

Reply all
Reply to author
Forward
0 new messages