Options

Running shell_package gives errors

I am using Vertica 7.1, community edition 3 nodes cluster.

I've installed library from https://github.com/vertica/Vertica-Extension-Packages/tree/master/shell_package
From this library the function int_sequence works just fine, but shell_execute gives an error.
This is a function:
dbadmin=> \df shell_execute
                         List of functions
 procedure_name | procedure_return_type | procedure_argument_types
----------------+-----------------------+--------------------------
 shell_execute  | Integer, Varchar      | Varchar


As per documentation, this example should work but gives error:
dbadmin=> select shell_execute(local_node_name(),'date') over ();
ERROR 3457:  Function shell_execute(varchar, unknown) does not exist, or permission is denied for shell_execute(varchar, unknown)
HINT:  No function matches the given name and argument types. You may need to add explicit type casts

Also, from above I see it should accept 1 parameter? So if I re-run, anyway it gives error:
dbadmin=> select shell_execute('date') over ();
ERROR 3399:  Failure in UDx RPC call InvokeProcessPartition(): Error calling processPartition() in User Defined Object [shell_execute] at [/opt/vertica/sdk/include/VerticaUDx.h:4048], error code: 0, message: User code caused Vertica to throw exception "Function attempted to access parameter cmd when it was not provided"

Could you please provide some insites what is wrong and how to make it run?

Thank you,
Oleg




Comments

  • Options
    Hi!
    Make sure the user running the Vertica process is able to sudo to user 'nobody' without password and without having a tty. The following /etc/sudoers entry should work:  dbadmin ALL=(nobody) NOPASSWD: ALL Defaults:dbadmin !requiretty  Alternatively, add -DNO_SUDO to CXXFLAGS in the Makefile to have the commands run as the Vertica process, and rebuild from source. Note that even though running as 'nobody' is not secure (one user could harm or inspect another user's process), at least it is a bit safer in that an accidental "rm -rf" will not delete your database. 
    Try next:
    daniel=> select shell_execute(local_node_name() USING PARAMETERS cmd='date +%s') over ();
    line_num | text
    ----------+-------------
    0 | 1402421210

    1 |
    (2 rows)

    (Adam?)
  • Options
    Thanks Daniel, your suggestion "
    USING PARAMETERS " 
    works perfectly. Much appreciated.

  • Options
    Prasanta_PalPrasanta_Pal - Select Field - Employee
    Sometime, the error could be due the following:

    Function shell_execute(varchar, unknown) does not exist, or permission is denied for shell_execute(varchar, unknown

    Resolution
    -----------------------
    * Make sure there are no extraneous spaces before the command #!/bin/bash.

    * If you are using programs within the external procedure, such as vsql, make sure the program is fully pathed in the script—even if it's already in the search path; for example /opt/vertica/bin/vsql
    --------


Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file