dockercassandracqludf

How to enable user defined functions in docker instance of cassandra?


Getting the following error when i try to create a simple subtraction function in cassandra:

user defined functions are disabled in cassandra.yaml set enable user defined functions=true

I can't figure out how to set it to true. Where do I go to do this? I am running a docker instance of cassandra which makes it more difficult.


Solution

  • You will need to modify the cassandra.yaml file within your Dockerfile. You could create a separate layer as an extension of your original Cassandra image (more here).

    Assuming you are using Cassandra 3, and that you installed from the package installation, its location is:

    /etc/cassandra/cassandra.yaml
    

    Other possible locations for different installation options (tarball, etc.) are documented here. If you are running this Docker image, you should probably find it in /etc/cassandra.

    Once you figure out the path for the installation, you could use sed to change the file in place. Run it with Docker's RUN command:

    RUN sed -i -r 's/enable_user_defined_functions=false/enable_user_defined_functions=true/' /etc/cassandra/cassandra.yaml
    

    Then restart a node.