Topic
7 replies Latest Post - ‏2013-10-01T20:08:54Z by pschwamb
pschwamb
pschwamb
4 Posts
ACCEPTED ANSWER

Pinned topic Setup Recovery Database via Scripted Install

‏2013-09-27T19:39:21Z |

I am trying to create a fully automated installation and configuration of streams on a Red Hat Linux Enterprise cluster. This has been successful for everything but configuring the recovery database without user input. I can assume that the DB2 instance already exists and that the user provides me all of the connection information as attributes to my script. However, the setupdb command does not appear to have a way to send passwords in without user interaction. I have tried several methods of input redirection at the command line (bash shell) but the script cannot read my input properly.

Is there a way to automate the recovery database configuration?

Here are two examples of what I have tried (and several variations in between):

streamtool setupdb --global --dbadmin db2user --dbuser db2user --dbname streams --host  db2host.fullpath.net --port 50000 --overwrite << EOF
password
password
EOF

export PW=password\npassword
echo "$PW" | streamtool setupdb --global --dbadmin db2user --dbuser db2user --dbname streams --host db2host.fullpath.net --port 50000 --overwrite

I recieve the following error no matter how I try to redirect the input. Using the verbose flag does not provide any additional information.  When I run the command interactively it completes as expected.

Exception in thread "main" java.lang.NullPointerException
        at com.ibm.streams.admin.internal.core.command.Command.promptForPassword(Command.java:407)
        at com.ibm.streams.database.internal.DatabaseCommand.dosetupdb(DatabaseCommand.java:158)
        at com.ibm.streams.database.internal.DatabaseCommand.performCommandProcessing(DatabaseCommand.java:84)
        at com.ibm.streams.admin.internal.core.command.Command.run(Command.java:444)
        at com.ibm.streams.database.internal.DatabaseCommand.main(DatabaseCommand.java:306)

Any assistance is greatly appreciated.

  • Cauhape
    Cauhape
    15 Posts
    ACCEPTED ANSWER

    Re: Setup Recovery Database via Scripted Install

    ‏2013-09-27T20:23:28Z  in response to pschwamb

    pschwamb,

    I haven't found anything in the documentation yet, but it seems like a reasonable thing to do. I will follow up when I have more information.

    Jeff C.

     

    • pschwamb
      pschwamb
      4 Posts
      ACCEPTED ANSWER

      Re: Setup Recovery Database via Scripted Install

      ‏2013-09-27T20:27:07Z  in response to Cauhape

      Thank you very much Jeff. We currently have releases for the 3.1 version and a 3.2 beta that we are developing on top of. I will wait to see what you come back with.

      • Cauhape
        Cauhape
        15 Posts
        ACCEPTED ANSWER

        Re: Setup Recovery Database via Scripted Install

        ‏2013-09-30T16:57:33Z  in response to pschwamb

        As it turns out, there is no available interface to these utilities which will allow you to embed user names and passwords into a script for an automated install.

        However, this can be accomplished using the open source Expect utility. In fact, that's it's major claim to fame is supporting interactive input in a shell script. Expect is an extension of TcL

        Here is the home page for Expect: http://expect.sourceforge.net/

        And some possibly useful articles related to it's use:

        https://www.ibm.com/developerworks/community/blogs/brian/entry/when_to_use_expect_scripting_and_when_to_avoid_it10?lang=en

        http://oreilly.com/catalog/expect/chapter/ch03.html

        http://www.admin-magazine.com/Articles/Automating-with-Expect-Scripts

        Jeff C.

         

         

        • pschwamb
          pschwamb
          4 Posts
          ACCEPTED ANSWER

          Re: Setup Recovery Database via Scripted Install

          ‏2013-09-30T17:18:53Z  in response to Cauhape

          Thank you Jeff. I did actually set up Expect to handle this for now but was hoping to avoid that since it requires installing additional packages on our boxes. Do you think this is an enhancement we can look forward to in a future release?

          • Cauhape
            Cauhape
            15 Posts
            ACCEPTED ANSWER

            Re: Setup Recovery Database via Scripted Install

            ‏2013-09-30T22:32:48Z  in response to pschwamb

            I'm requesting permissions to get into the database to check to see if there is already a request for this feature, but it probably be tomorrow before I know. If you are a customer, you can also open a PMR and make a feature request, and that will get into the system too.

            Jeff C.

             

          • Cauhape
            Cauhape
            15 Posts
            ACCEPTED ANSWER

            Re: Setup Recovery Database via Scripted Install

            ‏2013-10-01T20:05:49Z  in response to pschwamb

            I checked the project database and there are no requests for this feature. If you are a customer, please open a PMR and request it, and the request can get reviewed.

            Thanks,

            Jeff C.

             

            • pschwamb
              pschwamb
              4 Posts
              ACCEPTED ANSWER

              Re: Setup Recovery Database via Scripted Install

              ‏2013-10-01T20:08:54Z  in response to Cauhape

              Thanks Jeff. I will discuss this with our rep and see if we get a PMR open for it. I appreciate your time and assistance with this.