参考:
https://blog.youkuaiyun.com/shaw_young/article/details/78730724
资源:
官方主页:http://www.onecmdb.org/wiki/index.php?title=Main_Page
官方下载:http://sourceforge.net/projects/onecmdb/files/
环境:
centos 7.5 x64
mariadb 5.5.56
ip:192.168.3.5
安装linux64位系统32位支持包glibc.i686
yum list glibc*
yum install glibc.i686
解压到目录:
tar -xzvf onecmdb-2.1.0-linux.i386.tar.gz -C /opt
引入mysql jar包:
下载mysql-connector-java-5.1.48.tar.gz
tar -xzvf mysql-connector-java-5.1.48.tar.gz
cd mysql-connector-java-5.1.48
cp mysql-connector-java-5.1.48.jar /opt/onecmdb/tomcat/webapps/ROOT/WEB-INF/lib
编辑配置文件:
修改连接端口
cd /opt/onecmdb/tomcat/conf
vi server.xml
1、<Server port="8295" shutdown="SHUTDOWN">
2、<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="8388" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
3、<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8299"
enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />
修改setenv.sh文件
cd /opt/onecmdb/bin
vi setenv.sh
export ONECMDB_URL=http://localhost:8388
export ONECMDB_DESKTOP_URL=http://localhost:8388/onecmdb-desktop
修改onecmdb.xml文件
cd /opt/onecmdb/repository/OneCMDB_Core/Configuration
vi onecmdb.xml
<entry key="oneCMDBwsdl">http://localhost:8388/webservice/onecmdb</entry>
修改数据库配置文件
cd /opt/onecmdb/tomcat/webapps/ROOT/WEB-INF/classes
vi datasource.xml
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/onecmdb?useUnicode=true&characterEncoding=utf8" />
<property name="username" value="root" />
<property name="password" value="mysql" />
创建数据库
CREATE DATABASE IF NOT EXISTS onecmdb default charset utf8 COLLATE utf8_general_ci;
启动应用:
cd /opt/onecmdb/bin
./onecmdb.sh start
./onecmdb.sh stop
访问地址:
http://192.168.3.5:8388/onecmdb-desktop
管理账号
admin // 123
日志位置:
/opt/onecmdb/tomcat/logs
如果用的是5.0以上的mysql数据库,初始化时会报错:
2019-08-22 10:16:20,311 ERROR - SchemaUpdate.execute(155) | Unsuccessful: create table Attribute (id bigint not null, derivedFromId bigint, displayName varchar(255), alias varchar(255), complexValue bit, isBlueprint bit, description text, typeName varch
ar(255), reftypename varchar(255), valueAsString text, valueAsLong bigint, valueAsDate datetime, ownerId bigint, maxOccurs integer, minOccurs integer, lastModified datetime, createTime datetime, primary key (id)) type=InnoDB
2019-08-22 10:16:20,312 ERROR - SchemaUpdate.execute(156) | You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'type=InnoDB' at line 1
在5.0之后版本
type=InnoDB 被 engine=InnoDB 替代
手动到数据库执行
create table Attribute (id bigint not null, derivedFromId bigint, displayName varchar(255), alias varchar(255), complexValue bit, isBlueprint bit, description text, typeName varchar(255), reftypename varchar(255), valueAsString text, valueAsLong bigint, valueAsDate datetime, ownerId bigint, maxOccurs integer, minOccurs integer, lastModified datetime, createTime datetime, primary key (id)) engine=InnoDB;
create table CI (id bigint not null, derivedFromId bigint, displayName varchar(255), alias varchar(255), gid bigint, path text, isBlueprint bit, description text, sourceId bigint, sourceAttributeId bigint, targetId bigint, sourceTemplatePath text, targetTemplatePath text, lastModified datetime, createTime datetime, primary key (id)) engine=InnoDB;
create table CMDBTX (id bigint not null, name varchar(255), status integer, issuer varchar(255), insertTs datetime, beginTs datetime, endTs datetime, rejectCause varchar(255), ciModified integer, ciAdded integer, ciDeleted integer, primary key (id)) engine=InnoDB;
create table RFC (id bigint not null, RFC_TYPE varchar(255) not null, parentId bigint, targetId bigint, targetCIId bigint, targetAlias varchar(255), txId bigint, ts datetime, destroyedAlias varchar(255), destroyedId bigint, wasCi bit, newAlias varchar(255), oldAlias varchar(255), newTemplate bit, oldTemplate bit, description text, newDisplayNameExpression varchar(255), oldDisplayNameExpression varchar(255), fromId bigint, toId bigint, toAlias varchar(255), oldReferenceTypeAlias varchar(255), newReferenceTypeAlias varchar(255), oldTypeAlias varchar(255), newTypeAlias varchar(255), oldMaxOccurs integer, newMaxOccurs integer, oldMinOccurs integer, newMinOccurs integer, oldValue text, newValue text, newValueAsAlias varchar(255), value text, indx integer, alias varchar(255), valueAsAlias varchar(255), oldOwnerId bigint, newOwnerId bigint, sourceAttributeId bigint, referenceTarget varchar(255), primary key (id)) engine=InnoDB;
--优点
部署简单
--缺点
界面UI不是很好看
全英文,无中文支持
本文详细介绍了一种配置和部署OneCMDB的方法,包括在CentOS 7.5 x64上安装所需的软件包,配置Tomcat服务器端口,设置数据库连接参数,以及解决在MySQL 5.0以上版本中遇到的初始化错误。
1万+

被折叠的 条评论
为什么被折叠?



