Open yodo-t opened 4 years ago
I have the same problem
I have the same problem
@yodo-t I solved this problem like this. On Centos 7, edited vim / usr / bin / ksql, removed "/" in the line "base_dir = $ (cd" $ (dirname "$ {BASH_SOURCE [0]}") / .. "&& pwd)"
#!/bin/bash
# (Copyright) [2017 - 2017] Confluent, Inc.
#
# Use shellcheck to lint this file
#
base_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" ).." && pwd )
: "${KSQL_CONFIG_DIR:="$base_dir/config"}"
# logj4 settings
if [ -z "$KSQL_LOG4J_OPTS" ]; then
# Test for files from dev -> packages so this will work as expected in dev if you have packages
# installed
if [ -e "$base_dir/config/log4j.properties" ]; then # Dev environment
KSQL_CONFIG_DIR="$base_dir/config"
elif [ -e "$base_dir/etc/ksql/log4j.properties" ]; then # Simple zip file layout
KSQL_CONFIG_DIR="$base_dir/etc/ksql"
elif [ -e "/etc/ksql/log4j.properties" ]; then # Normal install layout
KSQL_CONFIG_DIR="/etc/ksql"
fi
fi
: "${KSQL_LOG4J_OPTS:=""}"
# Use file logging by default
if [ -z "$KSQL_LOG4J_OPTS" ]; then
export KSQL_LOG4J_OPTS="-Dlog4j.configuration=file:$KSQL_CONFIG_DIR/log4j-file.properties"
fi
exec "$base_dir"/bin/ksql-run-class io.confluent.ksql.Ksql "$@"
@yodo-t I solved this problem like this. On Centos 7, edited vim / usr / bin / ksql, removed "/" in the line "base_dir = (cd" (dirname "$ {BASH_SOURCE [0]}") / .. "&& pwd)"
#!/bin/bash # (Copyright) [2017 - 2017] Confluent, Inc. # # Use shellcheck to lint this file # base_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" ).." && pwd ) : "${KSQL_CONFIG_DIR:="$base_dir/config"}" # logj4 settings if [ -z "$KSQL_LOG4J_OPTS" ]; then # Test for files from dev -> packages so this will work as expected in dev if you have packages # installed if [ -e "$base_dir/config/log4j.properties" ]; then # Dev environment KSQL_CONFIG_DIR="$base_dir/config" elif [ -e "$base_dir/etc/ksql/log4j.properties" ]; then # Simple zip file layout KSQL_CONFIG_DIR="$base_dir/etc/ksql" elif [ -e "/etc/ksql/log4j.properties" ]; then # Normal install layout KSQL_CONFIG_DIR="/etc/ksql" fi fi : "${KSQL_LOG4J_OPTS:=""}" # Use file logging by default if [ -z "$KSQL_LOG4J_OPTS" ]; then export KSQL_LOG4J_OPTS="-Dlog4j.configuration=file:$KSQL_CONFIG_DIR/log4j-file.properties" fi exec "$base_dir"/bin/ksql-run-class io.confluent.ksql.Ksql "$@"
This worked...Thanks!
The solution mentioned above didn't work for me. Removing the slash "/" from line 8 coused another error:
bin/ksql: line 8: cd: /bin..: No such file or directory
So i added curly brackets { }
to every base_dir
variable and removed slash "/" after it.
#!/bin/bash
# (Copyright) [2017 - 2017] Confluent, Inc.
#
# Use shellcheck to lint this file
#
base_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )
: "${KSQL_CONFIG_DIR:="${base_dir}config"}"
# logj4 settings
if [ -z "$KSQL_LOG4J_OPTS" ]; then
# Test for files from dev -> packages so this will work as expected in dev if you have packages
# installed
if [ -e "${base_dir}config/log4j.properties" ]; then # Dev environment
KSQL_CONFIG_DIR="${base_dir}config"
elif [ -e "${base_dir}etc/ksqldb/log4j.properties" ]; then # Simple zip file layout
KSQL_CONFIG_DIR="${base_dir}etc/ksqldb"
elif [ -e "/etc/ksqldb/log4j.properties" ]; then # Normal install layout
KSQL_CONFIG_DIR="/etc/ksqldb"
fi
fi
: "${KSQL_LOG4J_OPTS:=""}"
# Use file logging by default
if [ -z "$KSQL_LOG4J_OPTS" ]; then
export KSQL_LOG4J_OPTS="-Dlog4j.configuration=file:$KSQL_CONFIG_DIR/log4j-file.properties"
fi
exec "${base_dir}"bin/ksql-run-class io.confluent.ksql.Ksql "$@"
And the result is... no errors
# ksql http://localhost:8088
===========================================
= _ _ ____ ____ =
= | | _____ __ _| | _ \| __ ) =
= | |/ / __|/ _` | | | | | _ \ =
= | <\__ \ (_| | | |_| | |_) | =
= |_|\_\___/\__, |_|____/|____/ =
= |_| =
= The Database purpose-built =
= for stream processing apps =
===========================================
Copyright 2017-2022 Confluent Inc.
CLI v7.4.5, Server v7.4.5 located at http://localhost:8088
Server Status: RUNNING
Having trouble? Type 'help' (case-insensitive) for a rundown of how things work!
ksql> exit
Exiting ksqlDB.
#
Thanks @felipeavilis your solution the most suitable for me
Describe the bug When I run /bin/ksql, following error occurs.
To Reproduce Steps to reproduce the behavior, include:
The version of KSQL. v5.1.3 with CentOS Linux release 7.5.1804 (Core)
Sample source data.
Any SQL statements you ran None
Expected behavior /etc/ksql/log4j-file.properties will be read by KSQL.
Actual behaviour /usr/bin/ksql works. In CentOS7, there is a symlink as below
But /bin/ksql does not work. I think ksql command does not support when
base_dir
will become "/". Following error part's//etc/ksql/log4j-file.properties
is strange. ("/" is duplicated)Can you check it? Thanks.