Установка на FreeBSD
Материал из BiTel WiKi
Stark (Обсуждение | вклад) |
Varney (Обсуждение | вклад) (→Установка activemq) |
||
(9 промежуточных версий не показаны.) | |||
Строка 1: | Строка 1: | ||
+ | [[Категория:Установка]] | ||
+ | [[Категория:FreeBSD]] | ||
Пока есть такой ресурс : | Пока есть такой ресурс : | ||
http://behterev.su/index.php?pa=articles | http://behterev.su/index.php?pa=articles | ||
+ | == Установка openjdk == | ||
+ | Первоначально необходимо установить openjdk. | ||
+ | <pre> | ||
+ | # cd /usr/ports/java/openjdk[x] | ||
+ | # make config && make install clean && rehash | ||
+ | </pre> | ||
- | + | == Установка activemq == | |
+ | Устанавливаем activemq. | ||
+ | <pre> | ||
+ | # cd /usr/ports/net/activemq | ||
+ | # make config && make install clean && rehash | ||
+ | </pre> | ||
- | java.lang.NoClassDefFoundError: javax/xml/bind/DataBindingException | + | Конфигурация activemq по-умолчанию находится в /usr/local/etc/activemq/activemq.xml. |
+ | <pre> | ||
+ | <plugins> | ||
+ | <!-- drop messages that have been sent to the DLQ --> | ||
+ | <discardingDLQBrokerPlugin dropAll="true"/> | ||
+ | </plugins> | ||
+ | <systemUsage> | ||
+ | <systemUsage> | ||
+ | <memoryUsage> | ||
+ | <memoryUsage limit="128 mb"/> | ||
+ | </memoryUsage> | ||
+ | <storeUsage> | ||
+ | <storeUsage limit="10000 gb"/> | ||
+ | </storeUsage> | ||
+ | <tempUsage> | ||
+ | <tempUsage limit="1 gb"/> | ||
+ | </tempUsage> | ||
+ | </systemUsage> | ||
+ | </systemUsage> | ||
+ | |||
+ | <transportConnectors> | ||
+ | <transportConnector name="nio" uri="nio://127.0.0.1:61616"/> | ||
+ | </transportConnectors> | ||
+ | <!-- Web Console --> | ||
+ | <!-- | ||
+ | <import resource="jetty.xml"/> | ||
+ | --> | ||
+ | </pre> | ||
+ | |||
+ | Добавить в /etc/rc.conf: | ||
+ | <pre> | ||
+ | activemq_enable="YES" | ||
+ | activemq_javargs="-Xmx512M \ | ||
+ | -Djava.net.preferIPv4Stack=true \ | ||
+ | -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider \ | ||
+ | -Dorg.apache.activemq.UseDedicatedTaskRunner=true \ | ||
+ | -Djava.util.logging.config.file=logging.properties \ | ||
+ | -Dcom.sun.management.jmxremote" | ||
+ | </pre> | ||
+ | |||
+ | Запуск activemq: | ||
+ | <pre> | ||
+ | # /usr/local/etc/rc.d/activemq start | ||
+ | </pre> | ||
+ | |||
+ | Если все правильно, то activemq станет слушать порт, указанный в <transportConnectors>: | ||
+ | <pre> | ||
+ | # netstat -an | grep 61616 | ||
+ | tcp4 0 0 127.0.0.1.61616 *.* LISTEN | ||
+ | </pre> | ||
+ | |||
+ | и при раскоменченном веб консоли в конфиге | ||
+ | <pre> | ||
+ | # netstat -an | grep 8161 | ||
+ | tcp4 0 0 *.8161 *.* LISTEN | ||
+ | </pre> | ||
+ | |||
+ | http://localhost:8161/admin | ||
+ | |||
+ | == Второй вариант rc скриптов == | ||
+ | |||
+ | В этом варианте весь bgbilling находится в /usr/local/bgbilling и BGBillingServer в /usr/local/bgbilling/server. Заведен пользователь bg с home директорией /usr/local/bgbilling и соответсвенно все части bgbilling запускаются от этого пользователя. rc скрипты кидаем в /usr/local/etc/rc.d/ и ставим атрибут исполнения. в /etc/rc.conf добавляем: | ||
+ | |||
+ | === bgserver === | ||
+ | |||
+ | <pre> | ||
+ | bgserver_enable="YES" | ||
+ | ipv6_enable="YES" | ||
+ | ipv6_ipv4mapping="YES" | ||
+ | </pre> | ||
+ | |||
+ | [[IPv6]] и '''ipv6_ipv4mapping''' требуются для того, чтобы java смогла слушать на 127.0.0.1, по-умолчанию даже при выключенном IPv6 будет слушать только на '''::1'''. | ||
+ | |||
+ | дополнительно можно указать: | ||
+ | |||
+ | <pre> | ||
+ | bgserver_java="<путь до нужной java машины>" | ||
+ | bgserver_pid="<путь и имя pid фала>" | ||
+ | bgserver_chdir="<путь home BGBillingServer>" | ||
+ | bgserver_users="<имя пользователя от которого будет запускатся BGBillingServer>" | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | <pre> | ||
+ | #!/bin/sh | ||
+ | # | ||
+ | # PROVIDE: bgserver | ||
+ | # REQUIRE: DAEMON mysql | ||
+ | # KEYWORD: shutdown | ||
+ | # | ||
+ | # Add the following line to /etc/rc.conf to enable trac: | ||
+ | # bgserver_enable="YES" | ||
+ | # | ||
+ | |||
+ | . "/etc/rc.subr" | ||
+ | |||
+ | |||
+ | bgserver_enable=${bgserver_enable:-"NO"} | ||
+ | bgserver_java=${bgserver_java:-"/usr/local/openjdk6"} | ||
+ | bgserver_pid=${bgserver_pid:-"/var/run/bgbilling/bgserver.pid"} | ||
+ | bgserver_chdir=${bgbilling_chdir:-"/usr/local/bgbilling/server"} | ||
+ | bgserver_users=${bgserver_user:-"bg"} | ||
+ | CLASSPATH=${bgserver_chdir}:${bgserver_chdir}/lib/* | ||
+ | |||
+ | name=bgserver | ||
+ | rcvar=`set_rcvar` | ||
+ | |||
+ | foo="$bgserver_java/bin/java -Dapp.name=BGBillingServer -Dnetworkaddress.cache.ttl=3600 -Xmx512m -cp $CLASSPATH ru.bitel.common.bootstrap.Boot bitel.billing.server.Server start > ./log/server.out 2>&1" | ||
+ | boo="$bgserver_java/bin/java -Dnetworkaddress.cache.ttl=3600 -Djava.awt.headless=true -Xmx256m -cp $CLASSPATH bitel.billing.server.Server stop" | ||
+ | |||
+ | stop_cmd="bg_stop" | ||
+ | |||
+ | bg_stop() | ||
+ | { | ||
+ | rc_pid=$(check_pidfile $pidfile $procname) | ||
+ | if [ -z "$rc_pid" ]; then | ||
+ | [ -n "$rc_fast" ] && return 0 | ||
+ | _run_rc_notrunning | ||
+ | return 1 | ||
+ | fi | ||
+ | echo 'Stopping bgbilling.' | ||
+ | if $boo 2>/dev/null; then | ||
+ | wait_for_pids $rc_pid | ||
+ | else | ||
+ | echo -n 'bgbilling failed, trying kill: ' | ||
+ | kill -TERM $rc_pid | ||
+ | wait_for_pids $rc_pid | ||
+ | fi | ||
+ | } | ||
+ | |||
+ | load_rc_config $name | ||
+ | |||
+ | pidfile=${bgserver_pid} | ||
+ | command=/usr/sbin/daemon | ||
+ | command_args="-p ${pidfile} -u ${bgserver_users} ${foo}" | ||
+ | procname=$bgserver_java/bin/java | ||
+ | |||
+ | run_rc_command "$1" | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | |||
+ | === bgdataloader === | ||
+ | |||
+ | настройки в rc.conf по аналогии с bgserver | ||
+ | |||
+ | <pre> | ||
+ | #!/bin/sh | ||
+ | # | ||
+ | # PROVIDE: bgdataloader | ||
+ | # REQUIRE: DAEMON mysql | ||
+ | # KEYWORD: shutdown | ||
+ | # | ||
+ | # Add the following line to /etc/rc.conf to enable trac: | ||
+ | # bgdataloader_enable="YES" | ||
+ | # | ||
+ | |||
+ | . "/etc/rc.subr" | ||
+ | |||
+ | |||
+ | bgdataloader_enable=${bgdataloader_enable:-"NO"} | ||
+ | bgdataloader_java=${bgdataloader_java:-"/usr/local/openjdk6"} | ||
+ | bgdataloader_pid=${bgdataloader_pid:-"/var/run/bgbilling/bgdataloader.pid"} | ||
+ | bgdataloader_chdir=${bgdataloader_chdir:-"/usr/local/bgbilling/server"} | ||
+ | bgdataloader_users=${bgdataloader_user:-"bg"} | ||
+ | CLASSPATH=${bgdataloader_chdir}:${bgdataloader_chdir}/lib/* | ||
+ | |||
+ | name=bgdataloader | ||
+ | rcvar=`set_rcvar` | ||
+ | |||
+ | foo="$bgdataloader_java/bin/java -Dapp.name=BGDataLoader -Dnetworkaddress.cache.ttl=3600 -Xmx256m -cp ${CLASSPATH} ru.bitel.common.bootstrap.Boot bitel.billing.server.DataLoader -estart > ./log/dataloader.out 2>&1" | ||
+ | boo="$bgdataloader_java/bin/java -Dnetworkaddress.cache.ttl=3600 -Djava.awt.headless=true -Xmx256m -cp ${CLASSPATH} bitel.billing.server.DataLoader -estop" | ||
+ | |||
+ | stop_cmd="bg_stop" | ||
+ | |||
+ | bg_stop() | ||
+ | { | ||
+ | rc_pid=$(check_pidfile $pidfile $procname) | ||
+ | if [ -z "$rc_pid" ]; then | ||
+ | [ -n "$rc_fast" ] && return 0 | ||
+ | _run_rc_notrunning | ||
+ | return 1 | ||
+ | fi | ||
+ | echo 'Stopping bgbilling.' | ||
+ | if $boo 2>/dev/null; then | ||
+ | wait_for_pids $rc_pid | ||
+ | else | ||
+ | echo -n 'bgbilling failed, trying kill: ' | ||
+ | kill -TERM $rc_pid | ||
+ | wait_for_pids $rc_pid | ||
+ | fi | ||
+ | } | ||
+ | |||
+ | load_rc_config $name | ||
+ | |||
+ | pidfile=${bgdataloader_pid} | ||
+ | command=/usr/sbin/daemon | ||
+ | command_args="-p ${pidfile} ${foo}" | ||
+ | procname=$bgdataloader_java/bin/java | ||
+ | |||
+ | run_rc_command "$1" | ||
+ | |||
+ | </pre> | ||
+ | |||
+ | === bgscheduler === | ||
+ | |||
+ | настройки в rc.conf по аналогии с bgserver | ||
+ | |||
+ | <pre> | ||
+ | #!/bin/sh | ||
+ | # | ||
+ | # PROVIDE: bgscheduler | ||
+ | # REQUIRE: DAEMON mysql | ||
+ | # KEYWORD: shutdown | ||
+ | # | ||
+ | # Add the following line to /etc/rc.conf to enable trac: | ||
+ | # bgscheduler_enable="YES" | ||
+ | # | ||
+ | |||
+ | . "/etc/rc.subr" | ||
+ | |||
+ | |||
+ | bgscheduler_enable=${bgscheduler_enable:-"NO"} | ||
+ | bgscheduler_java=${bgscheduler_java:-"/usr/local/openjdk6"} | ||
+ | bgscheduler_pid=${bgscheduler_pid:-"/var/run/bgbilling/bgscheduler.pid"} | ||
+ | bgscheduler_chdir=${bgscheduler_chdir:-"/usr/local/bgbilling/server"} | ||
+ | bgscheduler_users=${bgscheduler_user:-"bg"} | ||
+ | CLASSPATH=${bgscheduler_chdir}:${bgscheduler_chdir}/lib/* | ||
+ | |||
+ | name=bgscheduler | ||
+ | rcvar=`set_rcvar` | ||
+ | |||
+ | foo="$bgscheduler_java/bin/java -Dapp.name=BGScheduler -Xmx256m -cp ${CLASSPATH} ru.bitel.common.bootstrap.Boot bitel.billing.server.TaskExecuter -estart > ./log/scheduler.out 2>&1" | ||
+ | boo="$bgscheduler_java/bin/java -Dnetworkaddress.cache.ttl=3600 -Djava.awt.headless=true -Xmx256m -cp ${CLASSPATH} bitel.billing.server.TaskExecuter -estop" | ||
+ | |||
+ | stop_cmd="bg_stop" | ||
+ | |||
+ | bg_stop() | ||
+ | { | ||
+ | rc_pid=$(check_pidfile $pidfile $procname) | ||
+ | if [ -z "$rc_pid" ]; then | ||
+ | [ -n "$rc_fast" ] && return 0 | ||
+ | _run_rc_notrunning | ||
+ | return 1 | ||
+ | fi | ||
+ | echo 'Stopping bgbilling.' | ||
+ | if $boo 2>/dev/null; then | ||
+ | wait_for_pids $rc_pid | ||
+ | else | ||
+ | echo -n 'bgbilling failed, trying kill: ' | ||
+ | kill -TERM $rc_pid | ||
+ | wait_for_pids $rc_pid | ||
+ | fi | ||
+ | } | ||
+ | |||
+ | load_rc_config $name | ||
+ | |||
+ | pidfile=${bgscheduler_pid} | ||
+ | command=/usr/sbin/daemon | ||
+ | command_args="-p ${pidfile} ${foo}" | ||
+ | procname=$bgscheduler_java/bin/java | ||
+ | |||
+ | run_rc_command "$1" | ||
+ | </pre> | ||
+ | |||
+ | == FAQ по FreeBSD == | ||
+ | * [[java.lang.NoClassDefFoundError: javax/xml/bind/DataBindingException]] |
Текущая версия на 00:14, 6 сентября 2016
Пока есть такой ресурс : http://behterev.su/index.php?pa=articles
Содержание |
Установка openjdk
Первоначально необходимо установить openjdk.
# cd /usr/ports/java/openjdk[x] # make config && make install clean && rehash
Установка activemq
Устанавливаем activemq.
# cd /usr/ports/net/activemq # make config && make install clean && rehash
Конфигурация activemq по-умолчанию находится в /usr/local/etc/activemq/activemq.xml.
<plugins> <!-- drop messages that have been sent to the DLQ --> <discardingDLQBrokerPlugin dropAll="true"/> </plugins> <systemUsage> <systemUsage> <memoryUsage> <memoryUsage limit="128 mb"/> </memoryUsage> <storeUsage> <storeUsage limit="10000 gb"/> </storeUsage> <tempUsage> <tempUsage limit="1 gb"/> </tempUsage> </systemUsage> </systemUsage> <transportConnectors> <transportConnector name="nio" uri="nio://127.0.0.1:61616"/> </transportConnectors> <!-- Web Console --> <!-- <import resource="jetty.xml"/> -->
Добавить в /etc/rc.conf:
activemq_enable="YES" activemq_javargs="-Xmx512M \ -Djava.net.preferIPv4Stack=true \ -Djava.nio.channels.spi.SelectorProvider=sun.nio.ch.PollSelectorProvider \ -Dorg.apache.activemq.UseDedicatedTaskRunner=true \ -Djava.util.logging.config.file=logging.properties \ -Dcom.sun.management.jmxremote"
Запуск activemq:
# /usr/local/etc/rc.d/activemq start
Если все правильно, то activemq станет слушать порт, указанный в <transportConnectors>:
# netstat -an | grep 61616 tcp4 0 0 127.0.0.1.61616 *.* LISTEN
и при раскоменченном веб консоли в конфиге
# netstat -an | grep 8161 tcp4 0 0 *.8161 *.* LISTEN
Второй вариант rc скриптов
В этом варианте весь bgbilling находится в /usr/local/bgbilling и BGBillingServer в /usr/local/bgbilling/server. Заведен пользователь bg с home директорией /usr/local/bgbilling и соответсвенно все части bgbilling запускаются от этого пользователя. rc скрипты кидаем в /usr/local/etc/rc.d/ и ставим атрибут исполнения. в /etc/rc.conf добавляем:
bgserver
bgserver_enable="YES" ipv6_enable="YES" ipv6_ipv4mapping="YES"
IPv6 и ipv6_ipv4mapping требуются для того, чтобы java смогла слушать на 127.0.0.1, по-умолчанию даже при выключенном IPv6 будет слушать только на ::1.
дополнительно можно указать:
bgserver_java="<путь до нужной java машины>" bgserver_pid="<путь и имя pid фала>" bgserver_chdir="<путь home BGBillingServer>" bgserver_users="<имя пользователя от которого будет запускатся BGBillingServer>"
#!/bin/sh # # PROVIDE: bgserver # REQUIRE: DAEMON mysql # KEYWORD: shutdown # # Add the following line to /etc/rc.conf to enable trac: # bgserver_enable="YES" # . "/etc/rc.subr" bgserver_enable=${bgserver_enable:-"NO"} bgserver_java=${bgserver_java:-"/usr/local/openjdk6"} bgserver_pid=${bgserver_pid:-"/var/run/bgbilling/bgserver.pid"} bgserver_chdir=${bgbilling_chdir:-"/usr/local/bgbilling/server"} bgserver_users=${bgserver_user:-"bg"} CLASSPATH=${bgserver_chdir}:${bgserver_chdir}/lib/* name=bgserver rcvar=`set_rcvar` foo="$bgserver_java/bin/java -Dapp.name=BGBillingServer -Dnetworkaddress.cache.ttl=3600 -Xmx512m -cp $CLASSPATH ru.bitel.common.bootstrap.Boot bitel.billing.server.Server start > ./log/server.out 2>&1" boo="$bgserver_java/bin/java -Dnetworkaddress.cache.ttl=3600 -Djava.awt.headless=true -Xmx256m -cp $CLASSPATH bitel.billing.server.Server stop" stop_cmd="bg_stop" bg_stop() { rc_pid=$(check_pidfile $pidfile $procname) if [ -z "$rc_pid" ]; then [ -n "$rc_fast" ] && return 0 _run_rc_notrunning return 1 fi echo 'Stopping bgbilling.' if $boo 2>/dev/null; then wait_for_pids $rc_pid else echo -n 'bgbilling failed, trying kill: ' kill -TERM $rc_pid wait_for_pids $rc_pid fi } load_rc_config $name pidfile=${bgserver_pid} command=/usr/sbin/daemon command_args="-p ${pidfile} -u ${bgserver_users} ${foo}" procname=$bgserver_java/bin/java run_rc_command "$1"
bgdataloader
настройки в rc.conf по аналогии с bgserver
#!/bin/sh # # PROVIDE: bgdataloader # REQUIRE: DAEMON mysql # KEYWORD: shutdown # # Add the following line to /etc/rc.conf to enable trac: # bgdataloader_enable="YES" # . "/etc/rc.subr" bgdataloader_enable=${bgdataloader_enable:-"NO"} bgdataloader_java=${bgdataloader_java:-"/usr/local/openjdk6"} bgdataloader_pid=${bgdataloader_pid:-"/var/run/bgbilling/bgdataloader.pid"} bgdataloader_chdir=${bgdataloader_chdir:-"/usr/local/bgbilling/server"} bgdataloader_users=${bgdataloader_user:-"bg"} CLASSPATH=${bgdataloader_chdir}:${bgdataloader_chdir}/lib/* name=bgdataloader rcvar=`set_rcvar` foo="$bgdataloader_java/bin/java -Dapp.name=BGDataLoader -Dnetworkaddress.cache.ttl=3600 -Xmx256m -cp ${CLASSPATH} ru.bitel.common.bootstrap.Boot bitel.billing.server.DataLoader -estart > ./log/dataloader.out 2>&1" boo="$bgdataloader_java/bin/java -Dnetworkaddress.cache.ttl=3600 -Djava.awt.headless=true -Xmx256m -cp ${CLASSPATH} bitel.billing.server.DataLoader -estop" stop_cmd="bg_stop" bg_stop() { rc_pid=$(check_pidfile $pidfile $procname) if [ -z "$rc_pid" ]; then [ -n "$rc_fast" ] && return 0 _run_rc_notrunning return 1 fi echo 'Stopping bgbilling.' if $boo 2>/dev/null; then wait_for_pids $rc_pid else echo -n 'bgbilling failed, trying kill: ' kill -TERM $rc_pid wait_for_pids $rc_pid fi } load_rc_config $name pidfile=${bgdataloader_pid} command=/usr/sbin/daemon command_args="-p ${pidfile} ${foo}" procname=$bgdataloader_java/bin/java run_rc_command "$1"
bgscheduler
настройки в rc.conf по аналогии с bgserver
#!/bin/sh # # PROVIDE: bgscheduler # REQUIRE: DAEMON mysql # KEYWORD: shutdown # # Add the following line to /etc/rc.conf to enable trac: # bgscheduler_enable="YES" # . "/etc/rc.subr" bgscheduler_enable=${bgscheduler_enable:-"NO"} bgscheduler_java=${bgscheduler_java:-"/usr/local/openjdk6"} bgscheduler_pid=${bgscheduler_pid:-"/var/run/bgbilling/bgscheduler.pid"} bgscheduler_chdir=${bgscheduler_chdir:-"/usr/local/bgbilling/server"} bgscheduler_users=${bgscheduler_user:-"bg"} CLASSPATH=${bgscheduler_chdir}:${bgscheduler_chdir}/lib/* name=bgscheduler rcvar=`set_rcvar` foo="$bgscheduler_java/bin/java -Dapp.name=BGScheduler -Xmx256m -cp ${CLASSPATH} ru.bitel.common.bootstrap.Boot bitel.billing.server.TaskExecuter -estart > ./log/scheduler.out 2>&1" boo="$bgscheduler_java/bin/java -Dnetworkaddress.cache.ttl=3600 -Djava.awt.headless=true -Xmx256m -cp ${CLASSPATH} bitel.billing.server.TaskExecuter -estop" stop_cmd="bg_stop" bg_stop() { rc_pid=$(check_pidfile $pidfile $procname) if [ -z "$rc_pid" ]; then [ -n "$rc_fast" ] && return 0 _run_rc_notrunning return 1 fi echo 'Stopping bgbilling.' if $boo 2>/dev/null; then wait_for_pids $rc_pid else echo -n 'bgbilling failed, trying kill: ' kill -TERM $rc_pid wait_for_pids $rc_pid fi } load_rc_config $name pidfile=${bgscheduler_pid} command=/usr/sbin/daemon command_args="-p ${pidfile} ${foo}" procname=$bgscheduler_java/bin/java run_rc_command "$1"