2025-04-10 11:26:55 +08:00

63 lines
1.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# OpenGauss Docker 单节点部署
这个Ansible项目用于快速部署OpenGauss Docker单节点实例基于官方OpenGauss容器镜像。
## 前提条件
- 目标服务器能够连接互联网
- 目标服务器上已安装Python 3
- 部署服务器上已安装Ansible
## 快速开始
### 1. 配置部署
1. 编辑 `inventory.ini` 文件,配置目标服务器信息:
```ini
[opengauss_servers]
opengauss ansible_host=192.168.1.100 ansible_user=root ansible_port=22
```
2. 根据需要修改 `vars/main.yml` 中的变量:
```yaml
# OpenGauss Docker配置
opengauss_version: "latest" # 使用最新版本
opengauss_container_name: "opengauss" # 容器名称
opengauss_port: 5432 # 容器内端口
opengauss_host_port: 8888 # 宿主机映射端口
opengauss_password: "Gauss@123" # 数据库密码,请修改为符合复杂度要求的密码
```
### 2. 执行部署
```bash
./deploy.sh
```
部署成功后,将显示连接信息。
### 3. 连接数据库
使用以下命令连接数据库:
```bash
gsql -d postgres -U gaussdb -W'您的密码' -h 服务器IP -p 8888
```
## 密码复杂度要求
OpenGauss密码必须符合以下要求
- 长度8个字符以上
- 必须同时包含大写字母、小写字母、数字、以及特殊符号
- 特殊符号仅包含"#?!@$%^&*-"
- "!$&"需要用转义符"\"进行转义
## 数据持久化
数据被持久化保存在目标服务器的 `/opengauss` 目录,可以通过修改 `vars/main.yml` 文件中的 `opengauss_data_dir` 变量来更改。
## 官方文档
更多信息请参考[OpenGauss容器镜像安装官方文档](https://docs.opengauss.org/zh/docs/latest/docs/InstallationGuide/%E5%AE%B9%E5%99%A8%E9%95%9C%E5%83%8F%E5%AE%89%E8%A3%85.html)