Changing the default port numbers

Before you begin

Make sure that you choose a port number that is not already in use.

To check the port number, you can review the /etc/services file to see whether the port number is specified for another process.

You can also use the netstat | grep port command to see whether the designated port is in use.

About this task

For security or port conflict reasons, you can change one or more default port numbers for the database access.

Important: Be careful when you are changing port numbers for Netezza Performance Server database access. Errors can severely affect the operation of your Netezza Performance Server system. If you are not familiar with editing resource shell files or changing environment variables, contact IBM Support for assistance.

To change the default port numbers for your Netezza Performance Server system, complete the following steps:

Procedure

  1. Log in to the Netezza Performance Server host as the nz user.
  2. Change to the /nz/kit/sys/init directory.
  3. Create a backup of the current nzinitrc.sh file:
    cp nzinitrc.sh nzinitrc.sh.backup
    Example:
    [nz@nzhost init]$ cp nzinitrc.sh nzinitrc.sh.backup
  4. Review the nzinitrc.sh file to see whether the Netezza® port or ports that are listed in Netezza Performance Server port numbers that you want to change are present in the file.
    For example, you might find a section that looks similar to the following, or you might find that these variables are defined separately within the nzinitrc.sh file.
    # Application Port Numbers
    # ------------------------
    
    # To change the application-level port numbers, uncomment the
    following lines,
    # and then change the numbers to their new values. Note that these
    new values
    # will need to be set on clients as well.
    
    # NZ_DBMS_PORT=5480;        export NZ_DBMS_PORT
    # NZ_CLIENT_MGR_PORT=5481;  export NZ_CLIENT_MGR_PORT
    # NZ_LOAD_MGR_PORT=5482;    export NZ_LOAD_MGR_PORT
    # NZ_BNR_MGR_PORT=5483;     export NZ_BNR_MGR_PORT
    # NZ_RECLAIM_MGR_PORT=5484; export NZ_RECLAIM_MGR_PORT

    If you do not find your variable or variables in the file, you can edit the file to define each variable and its new port definition. To define a variable in the nzinitrc.sh file, use the format NZ_DBMS_PORT=value; export NZ_DBMS_PORT.

    Tip: You can append the contents of the nzinitrc.sh.sample file to the nzinitrc.sh file to create an editable section of variable definitions. You must be able to log in to the Netezza Performance Server host as the root user; then, change to the /nz/kit/sys/init directory and run the following command:
    [nz@nzhost init]$cat nzinitrc.sh.backup nzinitrc.sh.sample
    >nzinitrc.sh
  5. Using a text editor, edit the nzinitrc.sh file. For each port that you want to change, remove the comment symbol (#) from the definition line and specify the new port number.
    For example, to change the NZ_DBMS_PORT variable value to 5486:
    NZ_DBMS_PORT=5486;        export NZ_DBMS_PORT
    # NZ_CLIENT_MGR_PORT=5481;  export NZ_CLIENT_MGR_PORT
    # NZ_LOAD_MGR_PORT=5482;    export NZ_LOAD_MGR_PORT
    # NZ_BNR_MGR_PORT=5483;     export NZ_BNR_MGR_PORT
    # NZ_RECLAIM_MGR_PORT=5484; export NZ_RECLAIM_MGR_PORT
  6. Carefully review the changes that you made to the nzinitrc.sh file to make sure that they are correct, and save the file.

    If you change the default port numbers, some of the Netezza Performance Server CLI commands might no longer work. For example, if you change the NZ_DBMS_PORT or NZ_CLIENT_MGR_PORT value, commands such as nzds, nzstate, and others can fail because they expect the default port value. To avoid this problem, copy the custom port variable definitions in the nzinitrc.sh file to the /export/home/nz/.bashrc file. You can edit the .bashrc file by using any text editor.

  7. Exit from the container, and open custom Netezza DBMS/CLI/LOAD/BNR ports in the Cloud Pak for Data System firewall.
    Follow the steps that are described in Opening custom ports.
  8. After opening the custom ports, log back in to the container as the nz user.
  9. To place the new port value or values into effect, stop and start the Netezza Performance Server system by using the following commands:
    nzstop
    nzstart
    Example:
    [nz@nzhost init]$ nzstop
    [nz@nzhost init]$ nzstart