zoukankan      html  css  js  c++  java
  • 在 K8S 上部署以 mysql 数据库作为后端存储的单机版 nacos

    Nacos 被用于:

    • 服务发现
    • 微服务配置信息管理

    部署 nacos 时,需要用到如下两个镜像,这两个镜像均来自于 nacos 官方发布到 docker hub 的镜像,

    nacos/nacos-server:latest https://hub.docker.com/r/nacos/nacos-server
    nacos/nacos-mysql:5.7  https://hub.docker.com/r/nacos/nacos-mysql
    

    碰到个奇葩的问题

    使用官方的nacos/nacos-server:2.0.1镜像,会报错,连接不上数据库:
    org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection; nested exception is java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
    
    Caused by: java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
    
    Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
    
    换成官方的nacos/nacos-server:latest镜像就可以连接上数据库,但是web页面访问后查看nacos版本竟然是2.0.1。
    
    

    操作步骤

    # 需要事先有存储卷
    1.kubectl create -f Namespace.yaml
    2.kubectl create -f nacos-mysql.yaml
    3.kubectl create -f nacos-mysql-service.yaml
    4.kubectl create -f ConfigMap.yaml
    5.kubectl create -f StatefulSet.yaml
    6.kubectl create -f nacos-service.yaml
    

    yaml文件下载地址

    https://files.cnblogs.com/files/sanduzxcvbnm/single_nacos.7z

  • 相关阅读:
    一文详解ORB-SLAM3
    模块、进程、线程回调函数的逆向
    EPT的开启与处理
    VT MSR、CR、 Exception、#PF
    VT MTF VM-Exit
    VT技术对于除零异常的拦截与派发到3号中断
    异常与中断
    KVM_SET_SREGS 64位设置错误
    SQL注入实验学习笔记
    Pwn之简单patch
  • 原文地址:https://www.cnblogs.com/sanduzxcvbnm/p/14886357.html
Copyright © 2011-2022 走看看