Published Geodatabase and Replication

3583
4
07-04-2015 01:13 PM
shafitrumboo
New Contributor III

We want to use published database for ArcGIS Server Map services for performance reason. These Map services will be used by application where user can view the data no write access.

1. What type of database should we use file or SQL read only

2. What is type of database replication available in ArcGIS server that we can run as overnight process to transfer data from Production to publish database

0 Kudos
4 Replies
RebeccaStrauch__GISP
MVP Emeritus

Shafi,

Base on my experience only....

Q1 - We use to publish read-only data from ArcSDE, but with the advancements to the file geodatabase (FGDB), and the fact that it can be stored on the local ArcGIS Server machine, I find the FGDB is faster. [however, our master data is stored, edited, managed, and maintained in ArcSDE]

Q2 - If you need the ups to happen live and in real time, then mayb the ArcSDE is the way to go.  For our shop, we usually take a new snapshot of the data at various intervals (monthly or as needed -- to a new temporary FGDB), do some additional process and testing on our EDN/development machine. Then when I'm ready to update on the services, it is relatively fast.  I use python scripts to do all the processing.

The main reason I prep on the dev machine before publishing is because to replace the FGDB and services, the services have to be shut down when I replace the FGDB.  Again, this can be scripted so it can be done relatively fast.

This is what works for us, but there may be better methods for your shop with ArcSDE.

shafitrumboo
New Contributor III

Do you anything readily available or give some pointers to automate whole process

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

Hi Shafi,

The tool I use is the stop/start/delete tool in the ArcGIS Server Administration Toolbox http://www.arcgis.com/home/item.html?id=12dde73e0e784e47818162b4d41ee340  by Kevin Hibma​ 

I haven't finalized/generalize my scripts yet to incorporate this script into a Stop/Replace/Start routine, so I do it in three steps. Run the script to stop, then do my renaming/replacing to the new FGDB that I already did all the magic to, then run the script to start every thing up again.  Downtime can be minimized this way.

For my use, I've updated the parameters so I could hard code a default server-name, port, admin account.

Once I enter the correct password, the Service List is populated so I can select what I services I would like to stop/start.

The script (with a little added comments):

'''
This script will stop or start all selected services selected after valid  ServerName, 
     Port, AdminUser, AdminPassword, action (Stop/Start/Delete) are entered, and
     services from populated service list are selected

Parameters required:
    - ServerName
    - Port
    - AdminUser
    - AdminPassword (SENT IN CLEAR TEXT! and will show in Results tab)
    - Stop or Start  (or delete....caution with this one...can leave option off ValueList if desired.)
   -----   Service(s) (multivalue list) ....this will be populated after above are input...
              use check boxes to select those you want action to be applied to
              
Functions:
    - gentoken  (creates token required for Admin changes)
    - stopStartServices
'''

import urllib, urllib2, json
import arcpy

# Functions:
def gentoken(server, port, adminUser, adminPass, expiration=60):
    #Re-usable function to get a token required for Admin changes
    
    query_dict = {'username':   adminUser,
                  'password':   adminPass,
                  'expiration': str(expiration),
                  'client':     'requestip'}
    
    query_string = urllib.urlencode(query_dict)
    url = "http://{}:{}/arcgis/admin/generateToken".format(server, port)
    
    token = json.loads(urllib.urlopen(url + "?f=json", query_string).read())
        
    if "token" not in token:
        arcpy.AddError(token['messages'])
        quit()
    else:
        return token['token']

def stopStartServices(server, port, adminUser, adminPass, stopStart, serviceList, token=None):  
    ''' Function to stop, start or delete a service.
    Requires Admin user/password, as well as server and port (necessary to construct token if one does not exist).
    stopStart = Stop|Start|Delete
    serviceList = List of services. A service must be in the <name>.<type> notation
    If a token exists, you can pass one in for use.  
    '''        
    # Get and set the token
    if token is None:       
        token = gentoken(server, port, adminUser, adminPass)
    
    # Getting services from tool validation creates a semicolon delimited list that needs to be broken up
    services = serviceList.split(';')
    
    #modify the services(s)    
    for service in services:        
        service = urllib.quote(service.encode('utf8'))
        op_service_url = "http://{}:{}/arcgis/admin/services/{}/{}?token={}&f=json".format(server, port, service, stopStart, token)        
        status = urllib2.urlopen(op_service_url, ' ').read()
        
        if 'success' in status:
            arcpy.AddMessage(str(service) + " === " + str(stopStart))
        else:
            arcpy.AddWarning(status)
    
    return 


if __name__ == "__main__": 
    
    # Gather inputs    
    server = arcpy.GetParameterAsText(0) 
    port = arcpy.GetParameterAsText(1) 
    adminUser = arcpy.GetParameterAsText(2) 
    adminPass = arcpy.GetParameterAsText(3) 
    stopStart = arcpy.GetParameter(4) 
    serviceList = arcpy.GetParameterAsText(5) 
    
    stopStartServices(server, port, adminUser, adminPass, stopStart, serviceList)

EDIT: I should add, that my scripts to create my new FGDB and feature datasets, and all the scripts to pre-process the data are so specific to my datasets, that they would not help you.  But if you have specific things that you have questions about, I may be able to supply snippets...and if needed, you may need to break them off to new questions.

shafitrumboo
New Contributor III

I have line,point and ploygon featureclasses

Does esri provides something that will allow us to replication only modified data from source to target (FGDB)

if not then replacing whole data will also work

0 Kudos