系列文章目录
前言
前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家。点击跳转到网站,这篇文章男女通用,看懂了就去分享给你的码吧。
Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。 Nacos 是构建以“服务”为中心的现代应用架构 (例如微服务范式、云原生范式) 的服务基础设施。
在Nacos的GitHub页面,提供有下载链接,可以下载编译好的Nacos服务端或者源代码:
GitHub主页:https://github.com/alibaba/nacos
GitHub的Release下载页:https://github.com/alibaba/nacos/releases
快速入门:https://nacos.io/zh-cn/docs/quick-start.html
解压下载的文件
tar -xvf nacos-server-1.4.1.tar.gz
进入nacos的conf目录,修改配置文件cluster.conf.example,拷贝为cluster.conf,修改里面的IP配置
#
# Copyright 1999-2018 Alibaba Group Holding Ltd.
#
# Licensed 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.
#
#it is ip
#example
127.0.0.1:8881
127.0.0.1:8882
127.0.0.1:8883
这里把Nacos都安装在一台机器上,仅供参考
然后修改application.properties文件,添加数据库配置
#*************** Config Module Related Configurations ***************#
### If use MySQL as datasource:
spring.datasource.platform=mysql
### Count of DB:
db.num=1
### Connect URL of DB:
db.url.0=jdbc:mysql://127.0.0.1:3306/test?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user.0=test
db.password.0=test
在其同目录,有一个nacos-mysql.sql文件,到指定的数据库执行以下。
将nacos文件夹复制三份,分别命名为:8881、8882、8883
然后分别修改三个文件夹中的application.properties,修改server.port为各自端口
然后分别启动三个nacos节点
./startup.sh -m standalone
nginx安装包,解压到任意非中文目录下
tar -xvf nginx-1.18.0.tar.gz
修改conf/nginx.conf文件,配置如下:
upstream nacos-cluster {
server 127.0.0.1:8881;
server 127.0.0.1:8882;
server 127.0.0.1:8883;
}
server {
listen 8848;
server_name localhost;
location /nacos {
proxy_pass http://nacos-cluster;
}
}
安装参考:Centos上安装Nginx(http://www.javacui.com/service/493.html)
由于上面已经配置好conf,安装好直接启动即可
/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
此时再访问8848端口,并在配置管理中增加一个配置,发现数据库config_info表中已经添加进去。