Nacos 搭建
Mysql 8.0安装 yum安装
# wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
# rpm -ivh mysql80-community-release-el7-3.noarch.rpm
# yum install mysql-server
# systemctl restart mysqld
# systemctl enable mysqld
# grep "password" /var/log/mysqld.log \\ 最后的是初始密码
# mysql -uroot -p
set global validate_password.policy=0;
set global validate_password.length=1;
alter user user() identified by "123456";
CREATE USER 'root'@'%' IDENTIFIED BY '123456'; \\ 给所有用户权限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION; \\ 给所有用户权限
Java 1.8 jdk 安装
# tar zxvf jdk-8u271-linux-x64.tar.gz -C /usr/local
# ln -s /usr/local/jdk1.8.0_271 /usr/local/java
# vim /etc/profile
export JAVA_HOME=/usr/local/java
export CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib
export PATH=$JAVA_HOME/bin:/usr/local/nginx/sbin:/usr/local/mysql/bin:$PATH
# source /etc/profile
# java -version \\ java version "1.8.0_271"
Nacos 1.2.1 单机安装
# wget https://github.com/alibaba/nacos/releases/download/1.2.1/nacos-server-1.2.1.tar.gz
# tar zxvf nacos-server-1.2.1.tar.gz -C /usr/local/
# cd /usr/local/nacos/conf/
# mysql -uroot -p
CREATE DATABASE IF NOT EXISTS nacos default charset utf8 COLLATE utf8_bin;
use nacos;
source nacos-mysql.sql;
exit
# vim /usr/local/nacos/conf/application.properties \\ 主 配置文件
server.port=8848
spring.datasource.platform=mysql
db.url.0=jdbc:mysql://127.0.0.1:3306/nacos?serverTimezone=GMT%2B8&characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true
db.user=root
db.password=123456
# mkdir -p /usr/local/nacos/plugins/mysql/
# wget https://cdn.mysql.com//Downloads/Connector-J/mysql-connector-java-8.0.22.tar.gz
# tar zxf mysql-connector-java-8.0.22.tar.gz \\ 注意包 与mysql的版本一致 与mysql8连接需要 mysql5.7不需要
# cd mysql-connector-java-8.0.22/
# cp mysql-connector-java-8.0.22.jar /usr/local/nacos/plugins/mysql/
# sh /usr/local/nacos/bin/startup.sh -m standalone \\ 单台 启动
# /usr/local/nacos/bin/shutdown.sh \\ 停止
# vim /etc/rc.local
/usr/local/nacos/bin/startup.sh -m standalone \\ 开机启动
# tail -f /usr/local/nacos/logs/start.out \\ 启动日志
# tail /usr/local/nacos/logs/nacos.log \\ 日志
# ss -tnl \\ 8848被监听
http://192.168.10.13:8848/nacos/index.html#/login \\ 浏览器访问
用户名: nacos
密 码: nacos
注:
1. jdk下载地址 不能使用其他版本的jdk(不能使用openjdk) k051535@kok.work Teo@1234
https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html#license-lightbox
2. 官网地址 https://nacos.io/zh-cn/docs/quick-start.html
3. nacos下载地址 https://github.com/alibaba/nacos
4. https://dev.mysql.com/downloads/connector/j/
Platform independent --> mysql-connector-java-8.0.22.tar.gz --> No thanks, just start my download
5. 查看日志文件 报错 是由于nacos与mysql8 之间缺少 mysql-connector-java-8.0.22.jar
at com.alibaba.nacos.config.server.service.LocalDataSourceServiceImpl.reload
at com.alibaba.nacos.config.server.service.LocalDataSourceServiceImpl.init
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.factory.annotation... ...
at org.springframework.beans.factory.annotation... ...
at org.springframework.beans.factory.annotation... ...
732条评论