目录
1、安装MySQL数据库
2、安装Redis集群
3、初始化SQL
4、配置polaris-server.yaml
5、启动服务
6、安装polaris-console
7、启动polaris-console
8、安装监控组件
9、安装分布式限流组件
unzip polaris-limiter-release_v1.0.4.linux.amd64.zip mv polaris-limiter-release_v1.0.4.linux.amd64 polaris-limitercd polaris-limiter
启动
10、查看启动进程
11、页面访问
12、使用例子
数据库连接地址10.10.10.168 用户root 密码123456
MySQL安装参考搭建DSS环境(六)之安装基础环境MySQL_linux安装dss_青春不流名的博客-CSDN博客
IP | Resid PORT | Sentinel PORT | PASSWORD | Cluster NAME |
10.10.10.110 | 6379 | 26379 | 123456 | mymaster |
10.10.10.168 | 6379 | 26379 | 123456 | mymaster |
10.10.10.150 | 6379 | 26379 | 123456 | mymaster |
unzip polaris-server-release_v1.17.4.linux.amd64.zip
mv polaris-server-release_v1.17.4.linux.amd64 polaris-servercd polaris-server
mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 12 Server version: 8.0.31 MySQL Community Server - GPL Copyright (c) 2000, 2022, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> source ^C mysql> use polaris_server; Database changed mysql> source store/mysql/polaris_server.sql Query OK, 0 rows affected (0.00 sec)
# server Start guidance configuration
bootstrap:
# Global log
logger:
# Log scope name
# Configuration center related logs
config:
# Log file location
rotateOutputPath: log/runtime/polaris-config.log
# Special records of error log files at ERROR level
errorRotateOutputPath: log/runtime/polaris-config-error.log
# The maximum size of a single log file, 100 default, the unit is MB
rotationMaxSize: 100
# How many log files are saved, default 30
rotationMaxBackups: 30
# The maximum preservation days of a single log file, default 7
rotationMaxAge: 7
# Log output level,debug/info/warn/error
outputLevel: info
# Open the log file compression
compress: true
# onlyContent just print log content, not print log timestamp
# onlyContent: false
# Resource Auth, User Management Log
auth:
rotateOutputPath: log/runtime/polaris-auth.log
errorRotateOutputPath: log/runtime/polaris-auth-error.log
rotationMaxSize: 100
rotationMaxBackups: 30
rotationMaxAge: 7
outputLevel: info
compress: true
# Storage layer log
store:
rotateOutputPath: log/runtime/polaris-store.log
errorRotateOutputPath: log/runtime/polaris-store-error.log
rotationMaxSize: 100
rotationMaxBackups: 30
rotationMaxAge: 7
outputLevel: info
compress: true
# Server cache log log
cache:
rotateOutputPath: log/runtime/polaris-cache.log
errorRotateOutputPath: log/runtime/polaris-cache-error.log
rotationMaxSize: 100
rotationMaxBackups: 30
rotationMaxAge: 7
outputLevel: info
compress: true
# Service discovery and governance rules related logs
naming:
rotateOutputPath: log/runtime/polaris-naming.log
errorRotateOutputPath: log/runtime/polaris-naming-error.log
rotationMaxSize: 100
rotationMaxBackups: 30
rotationMaxAge: 7
outputLevel: info
compress: true
# Service discovery institutional health check log
healthcheck:
rotateOutputPath: log/runtime/polaris-healthcheck.log
errorRotateOutputPath: log/runtime/polaris-healthcheck-error.log
rotationMaxSize: 100
rotationMaxBackups: 30
rotationMaxAge: 7
outputLevel: info
compress: true
# XDS protocol layer plug -in log
xdsv3:
rotateOutputPath: log/runtime/polaris-xdsv3.log
errorRotateOutputPath: log/runtime/polaris-xdsv3-error.log
rotationMaxSize: 100
rotationMaxBackups: 30
rotationMaxAge: 7
outputLevel: info
compress: true
# Eureka protocol layer plug -in log
eureka:
rotateOutputPath: log/runtime/polaris-eureka.log
errorRotateOutputPath: log/runtime/polaris-eureka-error.log
rotationMaxSize: 100
rotationMaxBackups: 30
rotationMaxAge: 7
outputLevel: info
compress: true
# APISERVER common log, record inbound request and outbound response
apiserver:
rotateOutputPath: log/runtime/polaris-apiserver.log
errorRotateOutputPath: log/runtime/polaris-apiserver-error.log
rotationMaxSize: 100
rotationMaxBackups: 30
rotationMaxAge: 7
outputLevel: info
compress: true
default:
rotateOutputPath: log/runtime/polaris-default.log
errorRotateOutputPath: log/runtime/polaris-default-error.log
rotationMaxSize: 100
rotationMaxBackups: 30
rotationMaxAge: 7
outputLevel: info
compress: true
# server plugin logs
token-bucket:
rotateOutputPath: log/runtime/polaris-ratelimit.log
errorRotateOutputPath: log/runtime/polaris-ratelimit-error.log
rotationMaxSize: 100
rotationMaxBackups: 30
rotationMaxAge: 7
outputLevel: info
compress: true
discoverLocal:
rotateOutputPath: log/statis/polaris-discoverstat.log
errorRotateOutputPath: log/statis/polaris-discoverstat-error.log
rotationMaxSize: 100
rotationMaxBackups: 30
rotationMaxAge: 7
outputLevel: info
compress: true
local:
rotateOutputPath: log/statis/polaris-statis.log
errorRotateOutputPath: log/statis/polaris-statis-error.log
rotationMaxSize: 100
rotationMaxBackups: 30
rotationMaxAge: 7
outputLevel: info
compress: true
HistoryLogger:
rotateOutputPath: log/operation/polaris-history.log
errorRotateOutputPath: log/operation/polaris-history-error.log
rotationMaxSize: 100
rotationMaxBackups: 10
rotationMaxAge: 7
rotationMaxDurationForHour: 24
outputLevel: info
onlyContent: true
discoverEventLocal:
rotateOutputPath: log/event/polaris-discoverevent.log
errorRotateOutputPath: log/event/polaris-discoverevent-error.log
rotationMaxSize: 100
rotationMaxBackups: 30
rotationMaxAge: 7
outputLevel: info
onlyContent: true
cmdb:
rotateOutputPath: log/runtime/polaris-cmdb.log
errorRotateOutputPath: log/runtime/polaris-cmdb-error.log
rotationMaxSize: 100
rotationMaxBackups: 30
rotationMaxAge: 7
outputLevel: info
compress: true
# Start the server in order
startInOrder:
# Start the Polaris-Server in order, mainly to avoid data synchronization logic when the server starts the DB to pull the DB out of high load
open: true
# The name of the start lock
key: sz
# Register as Arctic Star Service
polaris_service:
## level: self_address > network_inter > probe_address
## Obtain the IP of the VM or POD where Polaris is located by making a TCP connection with the probe_adreess address
probe_address: 10.10.10.168:3306
## Set the name of the gateway to get your own IP
# network_inter: eth0
## Show the setting node itself IP information
# self_address: 127.0.0.1
# disable_heartbeat disable polaris_server node run heartbeat action to keep lease polaris_service
# disable_heartbeat: true
# Whether to open the server to register
enable_register: true
# Registered North Star Server Examples isolation status
isolated: false
# Service information that needs to be registered
services:
# service name
- name: polaris.checker
# Set the port protocol information that requires registration
protocols:
- service-grpc
# apiserver Configuration
apiservers:
# apiserver plugin name
- name: service-eureka
# apiserver additional configuration
option:
# tcp server listen ip
listenIP: "0.0.0.0"
# tcp server listen port
listenPort: 8761
# set the polaris namingspace of the EUREKA service default
namespace: default
# pull data from the cache of the polaris, refresh the data cache in the Eureka protocol
refreshInterval: 10
# eureka incremental instance changes time cache expiration cycle
deltaExpireInterval: 60
# unhealthy instance expiration cycle
unhealthyExpireInterval: 180
# whether to enable an instance ID of polaris to generate logic
generateUniqueInstId: false
# TCP connection number limit
connLimit:
# Whether to turn on the TCP connection limit function, default FALSE
openConnLimit: false
# The number of connections with the most IP
maxConnPerHost: 1024
# Current Listener's maximum number of connections
maxConnLimit: 10240
# Whitening list ip list, English comma separation
whiteList: 127.0.0.1
# Cleaning the cycle of link behavior
purgeCounterInterval: 10s
# How long does the unpretentious link clean up
purgeCounterExpired: 5s
- name: api-http
option:
listenIP: "0.0.0.0"
listenPort: 8090
# debug pprof switch
enablePprof: true
# swagger docs switch
enableSwagger: true
connLimit:
openConnLimit: false
maxConnPerHost: 128
maxConnLimit: 5120
whiteList: 127.0.0.1
purgeCounterInterval: 10s
purgeCounterExpired: 5s
# Set the type of open API interface
api:
# admin OpenAPI interface
admin:
enable: true
# Console OpenAPI interface
console:
enable: true
# OpenAPI group that needs to be exposed
include: [default, service, config]
# client OpenAPI interface
client:
enable: true
include: [discover, register, healthcheck, config]
# Polaris is a client protocol layer based on the gRPC protocol, which is used for registration discovery and service governance rule delivery
- name: service-grpc
option:
listenIP: "0.0.0.0"
listenPort: 8091
connLimit:
openConnLimit: false
maxConnPerHost: 128
maxConnLimit: 5120
# Open the protobuf parsing cache, cache the protobuf serialization results of the same content, and improve the processing of service discovery QPS
enableCacheProto: true
# Cache default size
sizeCacheProto: 128
# tls setting
tls:
# set cert file path
certFile: ""
# set key file path
keyFile: ""
# set trusted ca file path
trustedCAFile: ""
api:
client:
enable: true
include: [discover, register, healthcheck]
- name: config-grpc
option:
listenIP: "0.0.0.0"
listenPort: 8093
connLimit:
openConnLimit: false
maxConnPerHost: 128
maxConnLimit: 5120
api:
client:
enable: true
- name: xds-v3
option:
listenIP: "0.0.0.0"
listenPort: 15010
connLimit:
openConnLimit: false
maxConnPerHost: 128
maxConnLimit: 10240
# - name: service-l5
# option:
# listenIP: 0.0.0.0
# listenPort: 7779
# clusterName: cl5.discover
# Core logic configuration
auth:
# auth's option has migrated to auth.user and auth.strategy
# it's still available when filling auth.option, but you will receive warning log that auth.option has deprecated.
user:
name: defaultUser
option:
# Token encrypted SALT, you need to rely on this SALT to decrypt the information of the Token when analyzing the Token
# The length of SALT needs to satisfy the following one:len(salt) in [16, 24, 32]
salt: polarismesh@2021
strategy:
name: defaultStrategy
option:
# Console auth switch, default true
consoleOpen: true
# Console Strict Model, default true
consoleStrict: true
# Customer auth switch, default false
clientOpen: false
# Customer Strict Model, default close
clientStrict: false
namespace:
# Whether to allow automatic creation of naming space
autoCreate: true
naming:
# Batch controller
batch:
register:
open: true
# Task queue cache
queueSize: 10240
# The maximum waiting time for the number of mission is not full, and the time is directly forced to launch the BATCH operation
waitTime: 32ms
# Number of BATCH
maxBatchCount: 128
# Number of workers in the batch task
concurrency: 128
# Whether to turn on the discarding expiration task is only used for the batch controller of the register type
dropExpireTask: true
# The maximum validity period of the task is that the task is not executed when the validity period exceeds the validity period.
taskLife: 30s
deregister:
open: true
queueSize: 10240
waitTime: 32ms
maxBatchCount: 128
concurrency: 128
# Configuration of health check
healthcheck:
# Whether to open the health check function module
open: true
# The service of the instance of the health inspection task
service: polaris.checker
# Time wheel parameters
slotNum: 30
# It is used to adjust the next execution time of instance health check tasks in the time wheel, limit the minimum inspection cycle
minCheckInterval: 1s
# It is used to adjust the next execution time of instance health inspection tasks in the time wheel, limit the maximum inspection cycle
maxCheckInterval: 30s
# Used to adjust the next execution time of SDK reporting instance health checking tasks in the time wheel
clientReportInterval: 120s
batch:
heartbeat:
open: true
queueSize: 10240
waitTime: 32ms
maxBatchCount: 32
concurrency: 64
# since the three belong to the same type of health check plugin, only one can be enabled to use one
checkers:
- name: heartbeatRedis # Heartbeat examination plugin based on redis implementation
option:
deployMode: sentinel
addrs:
- "10.10.10.150:26379"
- "10.10.10.110:26379"
- "10.10.10.168:26379"
masterName: "mymaster"
sentinelUsername: "default" # sentinel 客户端的用户名
sentinelPassword: '123456' # sentinel 客户端的密码
kvPasswd: "123456" # redis 客户端的密码
poolSize: 233
minIdleConns: 30
idleTimeout: 120s
connectTimeout: 200ms
msgTimeout: 200ms
concurrency: 200
withTLS: false
# Configuration center module start configuration
config:
# Whether to start the configuration module
open: true
# Maximum number of number of file characters
contentMaxLength: 20000
# Cache configuration
cache:
open: true
resources:
- name: service # Load service data
option:
disableBusiness: false # Do not load business services
needMeta: true # Load service metadata
- name: instance # Load instance data
option:
disableBusiness: false # Do not load business service examples
needMeta: true # Load instance metadata
- name: routingConfig # Load route data
- name: rateLimitConfig # Load current limit data
- name: circuitBreakerConfig # Load the fuse data
- name: users # Load user and user group data
- name: strategyRule # Loading the rules of appraisal
- name: namespace # Load the naming space data
# Load Client-SDK instance data
- name: client
- name: configFile
- name: configGroup
- name: faultDetectRule
# - name: l5 # Load L5 data
# Maintain configuration
maintain:
jobs:
# Clean up long term unhealthy instance
- name: DeleteUnHealthyInstance
enable: false
option:
# Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
instanceDeleteTimeout: 60m
# Delete auto-created service without an instance
- name: DeleteEmptyAutoCreatedService
enable: false
option:
# Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
serviceDeleteTimeout: 30m
# Clean soft deleted instances
- name: CleanDeletedInstances
enable: true
option:
# Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
# instanceCleanTimeout: 10m
# Clean soft deleted clients
- name: CleanDeletedClients
enable: true
option:
# Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
# clientCleanTimeout: 10m
# Storage configuration
store:
## Database storage plugin
name: defaultStore
option:
master:
dbType: mysql
dbName: polaris_server
dbUser: root
dbPwd: 123456
dbAddr: 10.10.10.168:3306
maxOpenConns: 300
maxIdleConns: 50
connMaxLifetime: 300 # Unit second
txIsolationLevel: 2 #LevelReadCommitted
# polaris-server plugin settings
plugin:
crypto:
entries:
- name: AES
# whitelist:
# name: whitelist
# option:
# ip: [127.0.0.1]
cmdb:
name: memory
option:
url: ""
interval: 60s
history:
entries:
- name: HistoryLogger
discoverEvent:
entries:
- name: discoverEventLocal
discoverStatis:
name: discoverLocal
option:
# Statistical interval, the unit is second
interval: 60
statis:
entries:
- name: local
option:
interval: 60
- name: prometheus
ratelimit:
name: token-bucket
option:
# Whether to use remote configuration
remote-conf: false
# IP -level current, global
ip-limit:
# Whether the system opens IP -level current limit
open: false
global:
open: false
# Maximum peak
bucket: 300
# The average number of requests per second of IP
rate: 200
# Number of IP of the maximum cache
resource-cache-amount: 1024
white-list: [127.0.0.1]
instance-limit:
open: false
global:
bucket: 200
rate: 100
resource-cache-amount: 1024
# Interface-level ratelimit limit
api-limit:
# Whether to turn on the interface restriction and global switch, only for TRUE can it represent the flow restriction on the system.By default
open: false
rules:
- name: store-read
limit:
# The global configuration of the interface, if in the API sub -item, is not configured, the interface will be limited according to Global
open: false
# The maximum value of token barrels
bucket: 2000
# The number of token generated per second
rate: 1000
- name: store-write
limit:
open: false
bucket: 1000
rate: 500
apis:
- name: "POST:/v1/naming/services"
rule: store-write
- name: "PUT:/v1/naming/services"
rule: store-write
- name: "POST:/v1/naming/services/delete"
rule: store-write
- name: "GET:/v1/naming/services"
rule: store-read
- name: "GET:/v1/naming/services/count"
rule: store-read
bash /home/polaris-server/tool/stop.sh
bash /home/polaris-server/tool/start.sh
unzip polaris-console-release_v1.14.1.linux.amd64.zip mv polaris-console-release_v1.14.1.linux.amd64 polaris-console cd polaris-console
修改polaris-console.yaml文件
logger:
RotateOutputPath: log/polaris-console.log
RotationMaxSize: 500
RotationMaxAge: 30
RotationMaxBackups: 100
level: info
webServer:
mode: "release"
listenIP: "0.0.0.0"
listenPort: 8080
jwt:
secretKey: "polarismesh@2021"
expired: 1800
namingV1URL: "/naming/v1"
namingV2URL: "/naming/v2"
authURL: "/core/v1"
configURL: "/config/v1"
monitorURL: "/api/v1"
webPath: "web/dist/"
mainUser: "polaris"
polarisServer:
address: "127.0.0.1:8090"
monitorServer:
address: "127.0.0.1:9090"
访问地址Polaris控制台
外网访问建议设置访问控制策略
初始用户名和密码为polaris/polaris
bash /home/polaris-console/tool/stop.sh bash /home/polaris-console/tool/start.sh
访问地址http://ip:8080
默认polaris/polaris
tar -zxvf prometheus-2.28.0.linux-amd64.tar.gz
mv prometheus-2.28.0.linux-amd64 prometheus修改prometheus配置:打开 prometheus.yml文件,修改prometheus的job配置,增加http_sd_configs,其作用是告知prometheus需要从北极星获取应用的监控上报的地址。
# my global config global: scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. # scrape_timeout is set to the global default (10s). # Alertmanager configuration alerting: alertmanagers: - static_configs: - targets: # - alertmanager:9093 # Load rules once and periodically evaluate them according to the global 'evaluation_interval'. rule_files: # - "first_rules.yml" # - "second_rules.yml" # A scrape configuration containing exactly one endpoint to scrape: # Here it's Prometheus itself. scrape_configs: # The job name is added as a label `job=
` to any timeseries scraped from this config. - job_name: 'prometheus' # metrics_path defaults to '/metrics' # scheme defaults to 'http'. static_configs: - targets: ['localhost:9090'] http_sd_configs: - url: http://127.0.0.1:8090/prometheus/v1/clients honor_labels: true
启动服务
pkill -9 prometheus cd /home/prometheus chmod u+x * nohup ./prometheus --web.enable-lifecycle --web.enable-admin-api >> prometheus.out 2>&1 &
重启控制台:进入polaris-console的安装目录,执行以下语句重启。
bash /home/polaris-console/tool/stop.sh
bash /home/polaris-console/tool/start.sh
说明:
假如您的网络环境不支持 prometheus 主动从北极星 SDK 拉取(pull模式)监控指标,则需要部署 pushgateway 组件,同时调整 prometheus.yml 文件添加以下配置
- job_name: 'pushgateway' static_configs: - targets: ['${pushgateway 服务端IP}:9091']
bash /home/polaris-limiter/tool/stop.sh bash /home/polaris-limiter/tool/p.sh bash /home/polaris-limiter/tool/start.sh bash /home/polaris-limiter/tool/p.sh
unzip polaris-limiter-release_v1.0.4.linux.amd64.zip
mv polaris-limiter-release_v1.0.4.linux.amd64 polaris-limiter
cd polaris-limiter
节点ID,集群中不同节点需设置不同的myid
ps -ef | grep polaris
官网地址
集群版安装 | PolarisMesh