Push documents from source db to destination db by replication

Need lotusscript code to push documents from production server to staging server. A script should be used for one way replication(Pull only documents from Production server db into db on Staging server) in an existing button

Subject: Push documents from source db to destination db by replication

If you want to do push-only, you’ll need to write a script to issue the admin command via NotesSession.SendConsoleCommand.

Subject: Rich, got any ‘create fti’ tricks? (sorry for the hijack)

I posted in the 8.5 forum a few days back. I am building a self-serve ‘create replica’ system; an authorized user fills in a form that specifies dbs to push to another server and a scheduled agent does the deed. Everything works but I can’t get an FTI created by the code (FTIs can only be created local). For a number of reasons, I don’t think I can use the admin process (like I need to muck with ACL).

Any tips or tricks?

Subject: What’s wrong with the CreateFTIndex method ?

Subject: RE: What’s wrong with the CreateFTIndex method ?

Hi All,

Thanks for the response. Thing is if we use db.replicate it will do replication for all db properties like ACL, FOrms, Views. But i want only to move documents from prod to staging server. Please share that code.

Subject: RE: What’s wrong with the CreateFTIndex method ?

You said you wanted to do push replicaiton. That’s what I answered above. Now you say you just want to move documents and not ACL, design, etc. But are the databases replicas? I.e., do they share the same replicaId? If they are, and if you set up the ACL correctly (i.e., the destination server only grants the sending server Editor rights) then you can get exactly what you want from db.replicate.

-rich

Subject: RE: What’s wrong with the CreateFTIndex method ?

Please share that code.

Show us the code you have written this far. This is a forum for helping each other out, not a forum to request other people to do all the work for you.

If you can’t bother posting the code you already have, and show that you made an attempt at solving it yourself, why should anyone bother to spend their (unpaid) time writing your code?

There are plenty of consultants/developers that you can hire for even small projects. Your name sounds like you are in India, there are plenty of companies there doing Notes development.

You have to be careful, though. Some of them do take on any work, claiming they have experience/competence in for example Notes, even if that is not true. They then assign any free resource/programmer the task, even if he/she never even seen Notes. My company have had some experience of this… :frowning:

Also remember that certifications does not always show that the person is competent. If you look at LinkedIn, you even see people from IBM India wanting to get the test answers so they can pass it with no real knowledge.

About 15 years ago the company I worked for back then hired a (certified) programmer to write a fairly simple Notes application.When she delivered the result, not only did it look like crap (the UI was awful), but the code was incredible slow.

It worked in test with 10 documents, but when running on thousands of documents it came to a crawl.

The agent took 20 minutes to process a few thousand documents. She had used GetNthDocument() instead of GetFirstDocument/GetNextDocument… When I fixed the code it took 10 seconds to do the same thing.

So certification does not mean anything. :slight_smile:

Subject: It generates an error

I don’t have the full error but it’s along the lines of ‘nope…only on a local db’. I went back to the help file and it includes this:Usage

This method works only for local databases

So, I can’t use it with a background agent run on a server db.

I keep hoping there’s some clever way to get around this but so far no joy.

Subject: You can put it in an agent on your db, and call runonserver

Local means you can’t point to a db on another server with code and have it create an index, it the agent is running on the same server as the db it will create a FTi

Subject: RE: You can put it in an agent on your db, and call runonserver

Hmmm…interesting. I am, in fact, creating replicas from server a onto server b and the create code is running on server a.

Perhaps I just put in some kind of generic once a day agent on server b that cycles through all existing dbs, checks to see if they’re indexed and, if not, create the index.

Not terribly elegant but I bet that’d work!

I love this place…keep picking at a problem long enough and somebody will pop an idea that generates a thought that spawns another idea that results in a solution!

Thank you!

Subject: RE: Rich, got any ‘create fti’ tricks? (sorry for the hijack)

For Doug (the thread hijacker),

Write your own database for full text indexing requests (ftreq.nsf) nd put it on the pushed-to server. Have the agent that does the pushing write a doc into ftreq.nsf with the path of the newly pushed database. Create an agent in ftreq that runs on new/modified docs. It reads the path opens the pushed database local, and callse CreteFTIndex. Then it deletes the doc in ftreq.nsf, or marks it “Done”. (If you do the latter, the agent should always check for “Done” status before doing anything else, otherwise you’ll end up trying to re-create the index.)

-rich

Subject: Got it - updated and still confused

Sorry if this is a duplicate post, the original submit did some weird stuff…

Between you and Carl, the light went on. I was just going to loop through all the dbs once every , check for an FTI and build one if it’s missing. Your solution is way more elegant. OTOH, we’re only talking about 30 dbs or so; doing an ‘all db fti check’ isn’t going to stress the server.

Hijacking threads is bad form…but this actually worked.

Or not. Now I can’t get ‘createftindex’ to work.

http://www-10.lotus.com/ldd/nd85forum.nsf/DateAllThreadedWeb/E2A0395F8660D8F685257E68004ABBD7?opendocument&login

Subject: RE: Rich, got any ‘create fti’ tricks? (sorry for the hijack)

Am newbie and i already specified clearly i should replicate documents alone and not ACL forms Views. Please post clear information. I dont understand your past comments

Subject: RE: Rich, got any ‘create fti’ tricks? (sorry for the hijack)

Soirry for the confution - the above was a repsonse to Doug Finner’s quesiton, not yours. I have clarified it.

-rich

Subject: RE: Rich, got any ‘create fti’ tricks? (sorry for the hijack)

Configure replication settings to only replicate documents, not the design or ACL changes. Make sure the replica does not have “enforce consistent ACL across replicas” set.

Done.

Subject: Push documents from source db to destination db by replication

I think you just need to do a db.replicate and make sure the ACLs are set to the Staging server is a reader on the Production server.

Subject: RE: Push documents from source db to destination db by replication

In button code, I believe that db.replicate will execute with the user’s permissions, not the server’s permissions. This can be a problem if there are readername fields, and I presume that the user doing this will probably need to have more than just reader permission in the ACL.

-rich