# O2OA集群部署

## 说明

服务器环境由一下部分组成:

Web服务器

Center服务器

Application服务器

Storage服务器(附件存储服务器)

Data服务器(数据库服务器)

系统支持集群方式进行应用扩展.

![](https://3148786149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LmN_rNQCcekD6lUTyjN%2F-LmSLTcVLk9Rpdc-c8oC%2F-LmSLWCGsScNCZZnFgg3%2Fimage.png?alt=media\&token=9f372c7c-8e82-4ae5-909d-3d70e748fd1c)

扩展依靠配置文件实现,可以对以下服务器进行扩展:

Web服务器

Application服务器

Storage服务器

Data服务器

Center服务器（最新的开发版和11月份将发布的稳定版支持)

## 主机信息

主机：192.168.0.1

主机：192.168.0.2

## 集群需求

192.168.0.1：应用服务器，文件存储服务器，数据库服务器，中心服务器，WEB服务器

192.168.0.2：应用服务器，文件存储服务器，数据库服务器

## 配置步骤

### 一、配置节点标识

1、在主机192.168.0.1的o2server/local目录中修改或者新增文件node.cfg，修改内容为主机的域名或者IP（如果以域名访问，则内容为域名，如demo.o2oa.net）；

主机192.168.0.1的节点标识文件配置

| 192.168.0.1 |
| ----------- |

2、在主机192.168.0.2的o2server/local目录中修改或者新增文件node.cfg，修改内容为主机的域名或者IP（如果以域名访问，则内容为域名，如demo.o2oa.net）；

主机192.168.0.2的节点标识文件配置

| 192.168.0.2 |
| ----------- |

### 二、准备配置文件

双机集群需要准备两份服务器IP命名的配置文件（如果以域名访问，则需要以域名方式对文件命名如node\_demo.o2oa.net.json）：

1、从任一主机的o2server/configSample目录中copy文件node\_127.0.0.1.json到其他目录，命令为node\_192.168.0.1.json

2、同步骤1，从任一主机的o2server/configSample目录中copy文件node\_127.0.0.1.json到其他目录，命令为node\_192.168.0.2.json

3、修改node\_192.168.0.1.json，修改isPrimaryCenter = true，标记该服务器为中心服务器，配置文件如下：

| <p>{</p><p>  "enable": true,</p><p>  <strong>"isPrimaryCenter": true,</strong></p><p>  "application": {</p><p>   <strong>"enable": true,</strong></p><p>    ......</p><p>  },</p><p>  "web": {</p><p>    <strong>"enable": true,</strong></p><p>    ......</p><p>  },</p><p>  "data": {</p><p>    <strong>"enable": true,</strong></p><p>    ......</p><p>  },</p><p>  "storage": {</p><p>    <strong>"enable": true,</strong></p><p>    ......</p><p>  },</p><p>  ......</p><p>}</p> |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

3、修改node\_192.168.0.2.json，修改isPrimaryCenter = false，标记该服务器不是中心服务器，并且关闭该服务器的WEB服务器，配置文件如下：

| <p>{</p><p>  "enable": true,</p><p>  <strong>"isPrimaryCenter": false,</strong></p><p>  "application": {</p><p>    <strong>"enable": true,</strong></p><p>    ......</p><p>  },</p><p>  "web": {</p><p>    <strong>"enable": false,</strong></p><p>    "sslEnable": false,</p><p>    "proxyHost": "",</p><p>    ......</p><p>  },</p><p>  "data": {</p><p>    <strong>"enable": true,</strong></p><p>    ......</p><p>  },</p><p>  "storage": {</p><p>    <strong>"enable": true,</strong></p><p>    ......</p><p>  },</p><p>  ......</p><p>}</p> |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |

4、将配置文件node\_192.168.0.1.json和node\_192.168.0.2.json，同时放到两台服务器的o2server/config目录内.

### 三、启动服务器

1、启动服务器192.168.0.1

服务器192.168.0.1应该启动全部服务，所以在执行start\_windows.bat或者./start\_linux.sh后，直接键入start启动服务器即可。

2、启动服务器192.168.0.2

服务器192.168.0.2只需要启动部分服务，所以需要依次键入命令启动相应的服务器：

1）启动数据库服务器

键入命令：start data

2）启动文件存储服务器

键入命令：start storage

3）启动应用服务器

注意：192.168.0.2启动之前192.168.0.1的中心服务器一定要先启动完成，否则应用服务器启动会报错。

键入命令：start application


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://o2oa.gitbook.io/course/ping-tai-shi-shi/ji-qun-fang-shi-bu-shu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
