cloudstack远程调试

简介: cloudstack远程调试

前置条件:服务器安装好cloudstack的management、agent;

1、managemeng、agent启动服务文件

packaging/systemd


cloudstack-agent.default

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
 
JAVA_OPTS="-Djava.io.tmpdir=/usr/share/cloudstack-agent/tmp -Xms256m -Xmx2048m"
 
CLASSPATH="/usr/share/cloudstack-agent/lib/*:/usr/share/cloudstack-agent/plugins/*:/etc/cloudstack/agent:/usr/share/cloudstack-common/scripts"
 
JAVA_CLASS=com.cloud.agent.AgentShell
 
#You can uncomment this if you want to enable Java remote debugging.
#Feel free to change the parameters at your will. The 'address' field defines the port to be used.
#JAVA_DEBUG="-agentlib:jdwp=transport=dt_socket,address=*:8000,server=y,suspend=n"
 

cloudstack-agent.service

# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements.  See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership.  The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License.  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied.  See the License for the
# specific language governing permissions and limitations
# under the License.
 
# Do not modify this file as your changes will be lost in the next CSM update.
# If you need to add specific dependencies to this service unit do it in the
# /etc/systemd/system/cloudstack-management.service.d/ directory
 
[Unit]
Description=CloudStack Agent
Documentation=http://www.cloudstack.org/
Requires=libvirtd.service
After=libvirtd.service
 
[Service]
Type=simple
EnvironmentFile=/etc/default/cloudstack-agent
ExecStart=/usr/bin/java $JAVA_OPTS $JAVA_DEBUG -cp $CLASSPATH $JAVA_CLASS
Restart=always
RestartSec=10s
 
[Install]
WantedBy=multi-user.target

修改启动服务的配置文件

将配置文件的JAVA_DEBUG注释放开,如果agent与management,在同一设备,修改其中一个端口,如address=*:8081

/etc/default/cloudstack-agent
#JAVA_DEBUG="-agentlib:jdwp=transport=dt_socket,address=*:8000,server=y,suspend=n"
 
#agent的启动类
com.cloud.agent.AgentShell
 
/etc/default/cloudstack-management
#JAVA_DEBUG="-agentlib:jdwp=transport=dt_socket,address=*:8001,server=y,suspend=n"
 
#management启动类
org.apache.cloudstack.ServerDaemon

IDEA配置JVM远程调试

2、agent后台运行的命令

/usr/bin/java -Djava.io.tmpdir=/usr/share/cloudstack-agent/tmp -Xms256m -Xmx2048m -agentlib:jdwp=transport=dt_socket,address=*:8000,server=y,suspend=n -cp /usr/share/cloudstack-agent/lib/*:/usr/share/cloudstack-agent/plugins/*:/etc/cloudstack/agent:/usr/share/cloudstack-common/scripts com.cloud.agent.AgentShell

3、management后台运行的命令

/usr/bin/java -agentlib:jdwp=transport=dt_socket,address=*:8000,server=y,suspend=n -Djava.security.properties=/etc/cloudstack/management/java.security.ciphers -Djava.awt.headless=true -Dcom.sun.management.jmxremote=false -Xmx2G -XX:+UseParallelGC -XX:MaxGCPauseMillis=500 -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/log/cloudstack/management/ -XX:ErrorFile=/var/log/cloudstack/management/cloudstack-management.err -cp /usr/share/cloudstack-management/lib/*:/etc/cloudstack/management:/usr/share/cloudstack-common:/usr/share/cloudstack-management/setup:/usr/share/cloudstack-management:/usr/share/java/mysql-connector-java.jar:/usr/share/cloudstack-mysql-ha/lib/* org.apache.cloudstack.ServerDaemon

相关文章
|
Ubuntu 网络协议 开发工具
Ubuntu系统上All-in-one部署OpenStack
Ubuntu系统上All-in-one部署OpenStack
596 0
基于xenserver搭建cloudstack时出现的问题——求助
基于xenserver搭建cloudstack时出现的问题——求助
733 0