【问题标题】:Issues installing IDAS on CentOS 7 VM through provided RPMs通过提供的 RPM 在 CentOS 7 VM 上安装 IDAS 的问题
【发布时间】:2015-08-28 12:48:12
【问题描述】:

我一直在尝试通过UL2.0 RPMs(下载链接!)在其catalogue page 中的CentOS 7 VM 中安装IDAS GE。

我按照 github 上的说明进行操作,但按照说明部署部分的 section 3 启动 IoT 时遇到了困难。如果我执行 init_iotagent.sh,我在其中插入了 VM 的本地 IP,我会收到错误:

log4cplus:ERROR No appenders could be found for logger (main).
log4cplus:ERROR Please initialize the log4cplus system properly.
HTTPFilter DESTRUCTOR 0
HTTPFilter DESTRUCTOR 0

另外,在启动 IoTAgent as a Service 的说明中,它说:

安装 iot-agent-base RPM 后,可以在以下位置找到 init.d 脚本 这个文件夹 /usr/local/iot/init.d .

但是这个文件不存在,让我相信 IoTAgent 没有从提供的 RPM 中正确安装。

另外,我找不到有关 IoTAgent 的日志文件,只有 MongoDB 的日志文件位于 /usr/local/iot/mongodb-linux-x86_64-2.6.9/log/mongoc.log。

如果有人可以提供帮助,将不胜感激。另外,如果需要更多信息,请告诉我。

谢谢

【问题讨论】:

    标签: fiware iot


    【解决方案1】:

    我建议您获取 GitHub 存储库并从源代码构建 RPM,然后将其安装在您的 CentOS 中。就像文档中解释的那样:

    注意:我将 BUILD_TYPE 更改为 Release,因此我创建了 Release 目录。 GIT_VERSION 和 GIT_COMMIT 不是最新的。

    git clone https://github.com/telefonicaid/fiware-IoTAgent-Cplusplus.git
    cd fiware....
    mkdir -p build/Release
    cd build/Release
    cmake -DGIT_VERSION=20527 -DGIT_COMMIT=217023407f25ed258043cfc00a46b6c05fb0b52c -DMQTT=ON -DCMAKE_BUILD_TYPE=Release ../../
    make install
    make package
    

    包将位于 pack/Linux/RPM/

    rpm -i iot-agent-base-xxxxxxx (xxxxxxx will be the numbers of the build)
    rpm -i iot-agent-ul-xxxxxx (xxxxxxx will be the numbers of the build)
    

    使用 RPM 安装后,init.d 文件位于:/usr/local/iot/init.d/iotagent

    这是文件的内容:

    #!/bin/bash
    # Copyright 2015 Telefonica Investigación y Desarrollo, S.A.U
    # 
    # This file is part of fiware-IoTagent-Cplusplus (FI-WARE project).
    # 
    # iotagent         Start/Stop iotagent
    #
    # chkconfig: 2345 99 60
    # description: iotagent
    
    . /etc/rc.d/init.d/functions
    
    PARAM=$1
    INSTANCE=$2
    USERNAME=iotagent
    EXECUTABLE=/usr/local/iot/bin/iotagent
    CONFIG_PATH=/usr/local/iot/config
    
    iotagent_start()
    {
    
    
        local result=0
        local instance=${1}
    
        if [[ ! -x ${EXECUTABLE} ]]; then
            printf "%s\n" "Fail - missing ${EXECUTABLE} executable"
            exit 1
        fi
    
        if [[ -z ${instance} ]]; then
            list_instances="${CONFIG_PATH}/iotagent_*.conf"
        else
            list_instances="${CONFIG_PATH}/iotagent_${instance}.conf"
        fi
    
        for instance_config in ${list_instances}
        do
            local NAME
            NAME=${instance_config%.conf}
            NAME=${NAME#*iotagent_}
    
            source ${instance_config}
    
            local IOTAGENT_PID_FILE="/var/run/iot/iotagent_${NAME}.pid"
    
            printf "Starting iotagent ${NAME}..."
    
            status -p ${IOTAGENT_PID_FILE} ${EXECUTABLE} &> /dev/null 
            if [[ ${?} -eq 0 ]]; then
                printf "%s\n" " Already running, skipping $(success)"
                continue
            fi
    
    
            # Load the environment
            set -a
            source ${instance_config}
    
            # Mandatory parameters
            IOTAGENT_OPTS="   ${IS_MANAGER}              \
                           -n ${IOTAGENT_SERVER_NAME}    \
                           -v ${IOTAGENT_LOG_LEVEL}      \
                           -i ${IOTAGENT_SERVER_ADDRESS} \
                           -p ${IOTAGENT_SERVER_PORT}    \
                           -d ${IOTAGENT_LIBRARY_DIR}    \
                           -c ${IOTAGENT_CONFIG_FILE}"
    
            su ${USERNAME} -c "LD_LIBRARY_PATH=\"${IOTAGENT_LIBRARY_DIR}\" \
            ${EXECUTABLE} ${IOTAGENT_OPTS} & echo \$! > ${IOTAGENT_PID_FILE}" &> /dev/null 
            sleep 2 # wait some time to leave iotagent start
            local PID=$(cat ${IOTAGENT_PID_FILE})
            local var_pid=$(ps -ef | grep ${PID} | grep -v grep)
            if [[ -z "${var_pid}" ]]; then
                printf "%s" "pidfile not found"
                printf "%s\n" "$(failure)" 
                exit 1
            else
                printf "%s\n" "$(success)"
            fi
        done
    
        return ${result}
    
    }
    
    iotagent_stop()
    {
        local result=0
        local iotagent_instance=${1}
    
    
        if [[ -z ${iotagent_instance} ]]; then
            list_run_instances="/var/run/iot/iotagent_*.pid"
        else
            list_run_instances="/var/run/iot/iotagent_${iotagent_instance}.pid"
        fi
    
        if [[ $(ls -l ${list_run_instances} 2> /dev/null | wc -l) -eq 0 ]]; then
            printf "%s\n" "There aren't any instance of IoTAgent ${iotagent_instance} running $(success)"
            return 0
        fi
    
        for run_instance in ${list_run_instances}
        do
    
            local NAME
            NAME=${run_instance%.pid}
            NAME=${NAME#*iotagent_}
    
            printf "%s" "Stopping IoTAgent ${NAME}..."
    
            local RUN_PID=$(cat ${run_instance})
            kill ${RUN_PID}  &> /dev/null
            local KILLED_PID=$(ps -ef | grep ${RUN_PID} | grep -v grep | awk '{print $2}')
            if [[ -z ${KILLED_PID} ]]; then
                printf "%s\n" "$(success)"
            else
                printf "%s\n" "$(failure)"
                result=$((${result}+1))
            fi
    
            rm -f ${run_instance} &> /dev/null 
    
        done
        return ${result}
    }
    
    iotagent_status()
    {
        local result=0
        local iotagent_instance=${1}
    
        if [[ -z ${iotagent_instance} ]]; then
            list_run_instances="/var/run/iot/iotagent_*.pid"
        else
            list_run_instances="/var/run/iot/iotagent_${iotagent_instance}.pid"
        fi
    
        if [[ $(ls -l ${list_run_instances} 2> /dev/null | wc -l) -eq 0 ]]; then
            printf "%s\n" "There aren't any instance of IoTAgent ${iotagent_instance} running."
            return 1
        fi
    
        for run_instance in ${list_run_instances}
        do
    
            local NAME
            NAME=${run_instance%.pid}
            NAME=${NAME#*iotagent_}
    
            printf "%s\n" "IoTAgent ${NAME} status..."
            status -p ${run_instance} ${NODE_EXEC}
            result=$((${result}+${?}))
    
        done
    
        return ${result}
    }
    
    
    case ${PARAM} in
    
        'start')
            iotagent_start ${INSTANCE}
            ;;
    
        'stop')
            iotagent_stop ${INSTANCE}
            ;; 
    
        'restart')
            iotagent_stop ${INSTANCE}
            iotagent_start ${INSTANCE}
            ;;
    
        'status')
            iotagent_status ${INSTANCE}
            ;;
    esac
    

    日志文件在 /tmp/ 中:

    IoTAgent-IoTPlatform.log    
    IoTAgent.log    
    IoTAgent-Manager.log
    

    希望对你有所帮助。

    【讨论】:

    • 我在两台机器上尝试了这个,但由于它正在尝试构建 mongo-driver,所以这两台机器在“make install”中失败了。 Boost 和 log4cplus 构建正确,但由于某种原因 mongo-driver 失败。我应该在另一个问题上发布这个详细信息吗?输出:[ 9%] Performing update step for 'mongo-driver' [ 10%] No configure step for 'mongo-driver' [ 10%] Performing build step for 'mongo-driver' /bin/sh: scons: command not found make[2]: *** [third_party/mongo-driver/src/mongo-driver-stamp/mongo-driver-build] Error 127 make[1]: *** [CMakeFiles/mongo-driver.dir/all] Error 2 make: *** [all] Error 2
    • 缺少 scons。刚刚做了'yum install scons'。正在编译。
    猜你喜欢
    • 2020-08-02
    • 2013-07-30
    • 1970-01-01
    • 2020-11-04
    • 2017-08-30
    • 2018-06-05
    • 2018-06-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多