Difference between revisions of "Backup and Restore a GigaFlow Configuration"

From Observer GigaFlow Support | VIAVI Solutions Inc.
Jump to: navigation, search
 
(66 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
[[Category:Database]][[Category:Installation]]
 
[[Category:Database]][[Category:Installation]]
== Creating a GigaFlow Configuration Backup For Use On A New Server ==
 
  
After making changes to the GigaFlow server’s configuration, it’s important to make a backup of the configuration.
+
It is important to create a backup of the configuration after you did the changes to the GigaFlow server’s configuration.
  
Using Windows:
+
= Create a GigaFlow configuration backup for use on a new server on Windows =
  
# Open a Windows command prompt as administrator.
+
All the settings made to Gigaflow are stored in the '''Postgresql''' database. Thus, it is necessary to use the Postgres <code>pg_dump</code> command to perform the backup.
# Assuming that the PostgreSQL path has been added to windows, you can run the pg_dump command below directly. If not, either add it to the path or change the active directory to <code>C:\Program Files\PostgreSQL\X.X\bin</code>, where X.X is the PostgreSQL revision, e.g 9.5.
+
# Run: <br /><code>"D:\Program Files\PostgreSQL\10\bin\pg_dump.exe"  --table=attributecategories --table=attributevalues_0 --table=attributevalues_1 --table=attributevalues_2 --table=attributevalues_3 --table=attributevalues_4 --table=attributevalues_5 --table=attributevalues_6 --table=blacklistslocal --table=blacklistslocalentries --table=blacklistsources --table=customerdevicesettings --table=customersettings --table=dataaccessgroupmembers --table=dataaccessgroups --table=definedapplications --table=deviceinterfaces --table=devices  --table=eventtriggers --table=eventtypes --table=flowobjects --table=forensicsreports --table=geoips --table=gigastors --table=integrations --table=interfacealertsettings --table=interfacetypes --table=gigastores --table=ldapgroups --table=ldapusers  --table=multiservertargets --table=networkaudits --table=pentypes --table=penvendors --table=portalusers --table=portparams --table=profilers --table=profilerstoallowedprofiles --table=profilerstoentryprofiles --table=queryfielderservers --table=reportlinks --table=savedreports --table=serverparams --table=serversubnetport --table=serversubnets --table=snmppollerclasses --table=snmppollerclassesforsysoid --table=sqlreports --table=standardapplications --table=stattypes --table=syslogprocessors --table=syslogprocessorsdefault  --table=trafficgroups --table=trafficgroupsdeployed --table=trafficgroupsubnets --table=eventrunners --table=eventrunners_versioned --table=usergroups --table=userldapsettings --table=userpermissions --table=users --table=whitelist -U myipfix -f c:/temp/GigaFlowConfigBackup.sql</code>
+
# You may be prompted for the database password, i.e. <strong>myipfix</strong>. This will create the file GigaFlowConfigBackup.sql in the active directory. Move this to wherever you archive configurations.
+
  
== Restoring From a GigaFlow Configuration Backup ==
+
== Find the binaries for Windows ==
  
<strong>Warning: the following process will drop the existing database on the server.</strong>
+
The binaries will be installed in the '''Postgres''' installation folder. To find this folder, perform the following steps:
  
# Stop the GigaFlow service (GigaFlow.exe).
+
# Open the '''Services''' application in Windows.
# Upload the required GigaFlowConfigBackup.sql file to the machine.
+
# In the '''Services (Local)''' list, find the '''postgresqlXXXXX''' service.
# psql --host 127.0.0.1 --username=myipfix -c "drop database myipfix"
+
# Right-click the '''postgresqlXXXXX''' service, and select the '''Properties''' option.
# psql --host 127.0.0.1 --username=myipfix -c "create database myipfix owner=myipfix"
+
# From the '''General''' tab,  copy the '''"path to executable"''' string.<br />'''Note:''' This folder is the location required to run the backup and restore commands on (for example, '''D:\Program Files\PostgreSQL\11\bin\''').
# <code>psql --host 127.0.0.1 --username=myipfix < ./GigaFlowConfigBackup.sql<br />
+
# Open an administrator command prompt shell, and change the current working directory to that folder.
# You may be prompted for the database password, i.e. <strong>myipfix</strong>.
+
 
 +
== How to create a backup ==
 +
 
 +
# In the administrator command prompt shell, run the following command:<br /><code>pg_dump -E UTF8 --table=attributecategories --table=attributevalues_0 --table=attributevalues_1 --table=attributevalues_2 --table=attributevalues_3 --table=attributevalues_4 --table=attributevalues_5 --table=attributevalues_6 --table=blacklistslocal --table=blacklistslocalentries --table=blacklistsources --table=customerdevicesettings --table=customersettings --table=dataaccessgroupmembers --table=dataaccessgroups --table=definedapplications --table=deviceinterfaces --table=devices  --table=eventtriggers --table=eventtypes --table=flowobjects --table=forensicsreports --table=geoips --table=gigastors --table=integrations --table=interfacefilters --table=interfacealertsettings --table=interfacetypes --table=ldapgroups --table=ldapusers --table=ldapnestedgroups --table=multiservertargets --table=networkaudits --table=pentypes --table=penvendors --table=portalusers --table=portparams --table=profilers --table=profilerstoallowedprofiles --table=profilerstoentryprofiles --table=queryfielderservers --table=reportlinks --table=reportnameoverrides --table=savedreports --table=serverparams --table=serversubnetport --table=serversubnets --table=snmppollerclasses --table=snmppollerclassesforsysoid --table=sqlreports --table=standardapplications --table=stattypes --table=syslogprocessors --table=syslogprocessorsdefault  --table=trafficgroups --table=trafficgroupsdeployed --table=trafficgroupsubnets --table=eventrunners --table=eventrunners_versioned --table=definedservers --table=usergroups --table=userldapsettings --table=userpermissions --table=users --table=whitelist --table=azureaccounts --table=azurecontainers --table=aws_s3_bucket_config --table=awsconnections --table=cloudinstancetoip --table=fwevent --table=fwextcode --table=fwextcodestoappids --table=netflowignores --table=statnames --host=127.0.0.1 -U myipfix -f GigaFlowConfigBackup.sql</code>
 +
# You may be prompted for the database password, that is <strong>myipfix</strong>.<br />This will create the file '''GigaFlowConfigBackup.sql''' in the current directory.
 +
# Move the '''GigaFlowConfigBackup.sql''' file to the location where you store the archive configurations.
 +
 
 +
== How to restore from a GigaFlow configuration backup ==
 +
 
 +
<strong>Caution:</strong> The following process will drop the existing database on the server.
 +
 
 +
# In the '''Services (Local)''' list, right-click the '''GigaFlow''' service and select the '''Stop''' option.
 +
# Upload the required '''GigaFlowConfigBackup.sql''' file to the machine.
 +
# If you want to delete the old data, then run the following command:<br />'''Note:''' Make sure that the GigaFlow service is stopped.
 +
## <code>psql --host=127.0.0.1 --username=myipfix -c "drop database myipfix" postgres</code><br />'''Note:''' You may be prompted for the database password, that is <strong>myipfix</strong>.
 +
# To restore data from the configuration backup, run the following commnads:
 +
## <code>psql --host=127.0.0.1 --username=myipfix -c "create database myipfix owner=myipfix" postgres</code>
 +
## <code>psql --host=127.0.0.1 --username=myipfix < ./GigaFlowConfigBackup.sql</code><br />'''Note:''' You may be prompted for the database password, that is <strong>myipfix</strong>.
 
# Restart GigaFlow.
 
# Restart GigaFlow.
  
 +
If you want to reset the '''serverid''' on a new server, then run the following command:
 +
# <code>psql --host=127.0.0.1 --username=myipfix -c "delete from serverparams where key in('serverid','installtime','license')"</code>
 +
 +
 +
 +
 +
= Create a GigaFlow configuration backup for use on a new server on Linux =
 +
 +
All the settings made to Gigaflow are stored in the '''Postgresql''' database. Thus, it is necessary to use the Postgres <code>pg_dump</code> command to perform the backup.
 +
 +
== Find the binaries for Linux ==
 +
 +
The binaries will be installed in the '''Postgres''' installation folder. To find this folder, perform the following steps:
 +
 +
# Open a terminal prompt with suitable permissions.
 +
# Run the following command:<br /><code>ps aux | grep postmaster</code><br />'''Note:''' You should get an output similar to  '''<code>postgres    1834  0.0  0.4 17464052 443692 ?    Ss  Jul10  0:02 /usr/pgsql-11/bin/postmaster -D /var/lib/pgsql/11/data/</code>'''. For this example the string '''<code>/usr/pgsql-11/bin/</code>''' is the location of the required file.
 +
# Change the current working directory to that folder, and follow the backup and restore procedures.
 +
 +
== How to create a backup ==
 +
 +
# In the terminal prompt, run the following command:<br /><code>pg_dump -E UTF8 --table=attributecategories --table=attributevalues_0 --table=attributevalues_1 --table=attributevalues_2 --table=attributevalues_3 --table=attributevalues_4 --table=attributevalues_5 --table=attributevalues_6 --table=blacklistslocal --table=blacklistslocalentries --table=blacklistsources --table=customerdevicesettings --table=customersettings --table=dataaccessgroupmembers --table=dataaccessgroups --table=definedapplications --table=deviceinterfaces --table=devices  --table=eventtriggers --table=eventtypes --table=flowobjects --table=forensicsreports --table=geoips --table=gigastors --table=integrations --table=interfacefilters --table=interfacealertsettings --table=interfacetypes --table=ldapgroups --table=ldapusers --table=ldapnestedgroups --table=multiservertargets --table=networkaudits --table=pentypes --table=penvendors --table=portalusers --table=portparams --table=profilers --table=profilerstoallowedprofiles --table=profilerstoentryprofiles --table=queryfielderservers --table=reportlinks --table=reportnameoverrides --table=savedreports --table=serverparams --table=serversubnetport --table=serversubnets --table=snmppollerclasses --table=snmppollerclassesforsysoid --table=sqlreports --table=standardapplications --table=stattypes --table=syslogprocessors --table=syslogprocessorsdefault  --table=trafficgroups --table=trafficgroupsdeployed --table=trafficgroupsubnets --table=eventrunners --table=eventrunners_versioned --table=definedservers --table=usergroups --table=userldapsettings --table=userpermissions --table=users --table=whitelist --table=azureaccounts --table=azurecontainers --table=aws_s3_bucket_config --table=awsconnections --table=cloudinstancetoip --table=fwevent --table=fwextcode --table=fwextcodestoappids --table=netflowignores --table=statnames --host=127.0.0.1 -U myipfix -f GigaFlowConfigBackup.sql</code>
 +
# You may be prompted for the database password, that is <strong>myipfix</strong>.<br />This will create the file '''GigaFlowConfigBackup.sql''' in the current directory.
 +
# Move the '''GigaFlowConfigBackup.sql''' file to the location where you store the archive configurations.
 +
 +
== How to restore from a GigaFlow configuration backup ==
 +
 +
<strong>Caution:</strong> The following process will drop the existing database on the server.
 +
 +
# Stop the GigaFlow service. In the terminal prompt, run:<br /><code>systemctl stop gigaflow</code>
 +
# Upload the required '''GigaFlowConfigBackup.sql''' file to the machine.
 +
# If you want to delete the old data, then run the following commands:<br />'''Note:''' Make sure that the GigaFlow service is stopped.
 +
## <code>psql --host=127.0.0.1 --username=myipfix -c "drop database myipfix" postgres</code><br />'''Note:''' You may be prompted for the database password, that is <strong>myipfix</strong>.
 +
# To restore data from the configuration backup, run the following commnads:
 +
## <code>psql --host=127.0.0.1 --username=myipfix -c "create database myipfix owner=myipfix"  postgres</code>
 +
## <code>psql --host=127.0.0.1 --username=myipfix < ./GigaFlowConfigBackup.sql</code><br />'''Note:''' You may be prompted for the database password, that is <strong>myipfix</strong>.
 +
# Restart GigaFlow.
  
# Run below if you want to reset serverid on a new box:<br />psql --host 127.0.0.1 --username=myipfix -c "delete from serverparams where key in('serverid','installtime','license')"</code>
+
If you want to reset the '''serverid''' on a new server, then run the following command:
 +
# <code>psql --host=127.0.0.1 --username=myipfix -c "delete from serverparams where key in('serverid','installtime','license')"</code>

Latest revision as of 09:23, 23 November 2023


It is important to create a backup of the configuration after you did the changes to the GigaFlow server’s configuration.

Contents

Create a GigaFlow configuration backup for use on a new server on Windows

All the settings made to Gigaflow are stored in the Postgresql database. Thus, it is necessary to use the Postgres pg_dump command to perform the backup.

Find the binaries for Windows

The binaries will be installed in the Postgres installation folder. To find this folder, perform the following steps:

  1. Open the Services application in Windows.
  2. In the Services (Local) list, find the postgresqlXXXXX service.
  3. Right-click the postgresqlXXXXX service, and select the Properties option.
  4. From the General tab, copy the "path to executable" string.
    Note: This folder is the location required to run the backup and restore commands on (for example, D:\Program Files\PostgreSQL\11\bin\).
  5. Open an administrator command prompt shell, and change the current working directory to that folder.

How to create a backup

  1. In the administrator command prompt shell, run the following command:
    pg_dump -E UTF8 --table=attributecategories --table=attributevalues_0 --table=attributevalues_1 --table=attributevalues_2 --table=attributevalues_3 --table=attributevalues_4 --table=attributevalues_5 --table=attributevalues_6 --table=blacklistslocal --table=blacklistslocalentries --table=blacklistsources --table=customerdevicesettings --table=customersettings --table=dataaccessgroupmembers --table=dataaccessgroups --table=definedapplications --table=deviceinterfaces --table=devices --table=eventtriggers --table=eventtypes --table=flowobjects --table=forensicsreports --table=geoips --table=gigastors --table=integrations --table=interfacefilters --table=interfacealertsettings --table=interfacetypes --table=ldapgroups --table=ldapusers --table=ldapnestedgroups --table=multiservertargets --table=networkaudits --table=pentypes --table=penvendors --table=portalusers --table=portparams --table=profilers --table=profilerstoallowedprofiles --table=profilerstoentryprofiles --table=queryfielderservers --table=reportlinks --table=reportnameoverrides --table=savedreports --table=serverparams --table=serversubnetport --table=serversubnets --table=snmppollerclasses --table=snmppollerclassesforsysoid --table=sqlreports --table=standardapplications --table=stattypes --table=syslogprocessors --table=syslogprocessorsdefault --table=trafficgroups --table=trafficgroupsdeployed --table=trafficgroupsubnets --table=eventrunners --table=eventrunners_versioned --table=definedservers --table=usergroups --table=userldapsettings --table=userpermissions --table=users --table=whitelist --table=azureaccounts --table=azurecontainers --table=aws_s3_bucket_config --table=awsconnections --table=cloudinstancetoip --table=fwevent --table=fwextcode --table=fwextcodestoappids --table=netflowignores --table=statnames --host=127.0.0.1 -U myipfix -f GigaFlowConfigBackup.sql
  2. You may be prompted for the database password, that is myipfix.
    This will create the file GigaFlowConfigBackup.sql in the current directory.
  3. Move the GigaFlowConfigBackup.sql file to the location where you store the archive configurations.

How to restore from a GigaFlow configuration backup

Caution: The following process will drop the existing database on the server.
  1. In the Services (Local) list, right-click the GigaFlow service and select the Stop option.
  2. Upload the required GigaFlowConfigBackup.sql file to the machine.
  3. If you want to delete the old data, then run the following command:
    Note: Make sure that the GigaFlow service is stopped.
    1. psql --host=127.0.0.1 --username=myipfix -c "drop database myipfix" postgres
      Note: You may be prompted for the database password, that is myipfix.
  4. To restore data from the configuration backup, run the following commnads:
    1. psql --host=127.0.0.1 --username=myipfix -c "create database myipfix owner=myipfix" postgres
    2. psql --host=127.0.0.1 --username=myipfix < ./GigaFlowConfigBackup.sql
      Note: You may be prompted for the database password, that is myipfix.
  5. Restart GigaFlow.

If you want to reset the serverid on a new server, then run the following command:

  1. psql --host=127.0.0.1 --username=myipfix -c "delete from serverparams where key in('serverid','installtime','license')"



Create a GigaFlow configuration backup for use on a new server on Linux

All the settings made to Gigaflow are stored in the Postgresql database. Thus, it is necessary to use the Postgres pg_dump command to perform the backup.

Find the binaries for Linux

The binaries will be installed in the Postgres installation folder. To find this folder, perform the following steps:

  1. Open a terminal prompt with suitable permissions.
  2. Run the following command:
    ps aux | grep postmaster
    Note: You should get an output similar to postgres 1834 0.0 0.4 17464052 443692 ? Ss Jul10 0:02 /usr/pgsql-11/bin/postmaster -D /var/lib/pgsql/11/data/. For this example the string /usr/pgsql-11/bin/ is the location of the required file.
  3. Change the current working directory to that folder, and follow the backup and restore procedures.

How to create a backup

  1. In the terminal prompt, run the following command:
    pg_dump -E UTF8 --table=attributecategories --table=attributevalues_0 --table=attributevalues_1 --table=attributevalues_2 --table=attributevalues_3 --table=attributevalues_4 --table=attributevalues_5 --table=attributevalues_6 --table=blacklistslocal --table=blacklistslocalentries --table=blacklistsources --table=customerdevicesettings --table=customersettings --table=dataaccessgroupmembers --table=dataaccessgroups --table=definedapplications --table=deviceinterfaces --table=devices --table=eventtriggers --table=eventtypes --table=flowobjects --table=forensicsreports --table=geoips --table=gigastors --table=integrations --table=interfacefilters --table=interfacealertsettings --table=interfacetypes --table=ldapgroups --table=ldapusers --table=ldapnestedgroups --table=multiservertargets --table=networkaudits --table=pentypes --table=penvendors --table=portalusers --table=portparams --table=profilers --table=profilerstoallowedprofiles --table=profilerstoentryprofiles --table=queryfielderservers --table=reportlinks --table=reportnameoverrides --table=savedreports --table=serverparams --table=serversubnetport --table=serversubnets --table=snmppollerclasses --table=snmppollerclassesforsysoid --table=sqlreports --table=standardapplications --table=stattypes --table=syslogprocessors --table=syslogprocessorsdefault --table=trafficgroups --table=trafficgroupsdeployed --table=trafficgroupsubnets --table=eventrunners --table=eventrunners_versioned --table=definedservers --table=usergroups --table=userldapsettings --table=userpermissions --table=users --table=whitelist --table=azureaccounts --table=azurecontainers --table=aws_s3_bucket_config --table=awsconnections --table=cloudinstancetoip --table=fwevent --table=fwextcode --table=fwextcodestoappids --table=netflowignores --table=statnames --host=127.0.0.1 -U myipfix -f GigaFlowConfigBackup.sql
  2. You may be prompted for the database password, that is myipfix.
    This will create the file GigaFlowConfigBackup.sql in the current directory.
  3. Move the GigaFlowConfigBackup.sql file to the location where you store the archive configurations.

How to restore from a GigaFlow configuration backup

Caution: The following process will drop the existing database on the server.
  1. Stop the GigaFlow service. In the terminal prompt, run:
    systemctl stop gigaflow
  2. Upload the required GigaFlowConfigBackup.sql file to the machine.
  3. If you want to delete the old data, then run the following commands:
    Note: Make sure that the GigaFlow service is stopped.
    1. psql --host=127.0.0.1 --username=myipfix -c "drop database myipfix" postgres
      Note: You may be prompted for the database password, that is myipfix.
  4. To restore data from the configuration backup, run the following commnads:
    1. psql --host=127.0.0.1 --username=myipfix -c "create database myipfix owner=myipfix" postgres
    2. psql --host=127.0.0.1 --username=myipfix < ./GigaFlowConfigBackup.sql
      Note: You may be prompted for the database password, that is myipfix.
  5. Restart GigaFlow.

If you want to reset the serverid on a new server, then run the following command:

  1. psql --host=127.0.0.1 --username=myipfix -c "delete from serverparams where key in('serverid','installtime','license')"