部署nacos以及配置用户名密码

 先推荐下面官网



Nacos 快速开始 | Nacos 官网

Nacos Server 下载 | Nacos 官网

直接下载稳定版本2.5.0.zip文件即可,解压,linux运行bin目录下的sh文件,windows运行cmd文件;

配置nacos用户名密码:

修改applicaiton.yml文件。

### If turn on auth system:
nacos.core.auth.enabled=true

### Turn on/off caching of auth information. By turning on this switch, the update of auth information would have a 15 seconds delay.
nacos.core.auth.caching.enabled=true

### Since 1.4.1, Turn on/off white auth for user-agent: nacos-server, only for upgrade from old version.
nacos.core.auth.enable.userAgentAuthWhite=false

### Since 1.4.1, worked when nacos.core.auth.enabled=true and nacos.core.auth.enable.userAgentAuthWhite=false.
### The two properties is the white list for auth and used by identity the request from other server.
nacos.core.auth.server.identity.key=nacos
nacos.core.auth.server.identity.value=nacos

### worked when nacos.core.auth.system.type=nacos
### The token expiration in seconds:
nacos.core.auth.plugin.nacos.token.cache.enable=false
nacos.core.auth.plugin.nacos.token.expire.seconds=18000
### The default token (Base64 String):
nacos.core.auth.plugin.nacos.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789

在Linux上部署Nacos配置OceanBase数据源的步骤通常包括以下几个部分: 1. **安装Nacos**: - 更新系统包列表: `sudo apt-get update` - 安装Nacos服务器: `sudo apt-get install nacos-server` - 启动Nacos服务: `sudo systemctl start nacos-server` - 验证安装: 可通过访问`http://localhost:8848/nacos`来检查是否成功启动。 2. **下载OceanBase客户端驱动**: Nacos的数据源支持通过Spring Cloud Alibaba的Nacos Config组件来管理,所以需要获取对应的OceanBase Java驱动。可以从GitHub下载最新版本的Spring Cloud Alibaba依赖,或者在Maven仓库中添加依赖。 3. **配置Nacos Config数据源**: - 创建一个配置文件,比如在`conf/application.yml`中: ```yml spring: cloud: config: server: enabled: true profiles: dev bootstrap: uri: http://${nacos_host}:${nacos_port}/nacos/config ignore-ssl-errors: true nacos: discovery: server-addr: ${nacos_host}:${nacos_port} config: file-extension: yaml ``` - 这里`${nacos_host}`和`${nacos_port}`分别替换为Nacos的IP地址和端口。 4. **配置OceanBase连接信息**: 在数据源相关的配置中,你需要提供OceanBase数据库的连接属性,例如用户名密码、集群名、服务名等。这将作为Spring Boot应用从Nacos读取的配置内容。 5. **重启应用**: 如果之前有Spring Boot项目,使用命令`spring-boot-admin.restart`重启应用,以便应用加载新的配置。 6. **验证配置**: 应用应该可以成功连接到OceanBase并使用其作为数据源。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

早退的程序员

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值