安装数据收集器以进行分析
概述
分析功能通过数据收集器将数据从网络设备流式传输到 NorthStar 控制器,在那里对其进行处理、存储并可在 Web UI 中查看。
有关收集和查看遥测数据的信息,请参阅 NorthStar 控制器用户指南 。
需要使用 Junos OS 15.1F6 或更高版本才能使用分析。有关分析节点的硬件要求,请参阅 NorthStar 控制器系统要求。有关支持的部署方案,请参阅 平台和软件兼容性。
如果您未使用 NorthStar 应用程序高可用性 (HA),则可以在安装 NorthStar 控制器应用程序的同一节点(单服务器部署)中或在一个或多个专用于日志收集和存储的外部节点中安装数据收集器。在这两种情况下,提供的安装脚本都会负责安装所需的包和依赖项。
在 NorthStar 应用程序高可用性环境中,您有三个选项:
配置外部分析节点。
配置外部分析群集。分析群集在分析节点发生故障时提供备份节点。此群集可以是本地群集(在同一数据中心内)或地理多样性群集(分析地理 HA)。
在组成 NorthStar 群集的相同节点中安装数据收集器。在此方案中,NorthStar 应用程序群集节点也是分析群集节点。
分析过程中的配置选项是从 /opt/northstar/data/northstar.cfg 文件中读取的。在单服务器部署中,不需要进行特殊更改,因为启动收集器所需的参数是默认配置的一部分。 表 1 列出了分析过程从文件中读取的一些设置,供您参考。
设置 |
描述 |
---|---|
mq_host |
指向运行消息传递总线服务的主机(NorthStar 应用程序节点)的 IP 地址或虚拟 IP (VIP)(用于多个 NorthStar 节点部署)。如果不存在,则默认为 localhost 。 |
mq_username |
用于连接到消息传递总线的用户名。默认为 northstar。 |
mq_password_enc |
用于连接到消息传递总线的密码。没有默认值;如果未配置此功能,则服务将无法启动。在单服务器部署中,密码是在正常的应用程序安装过程中设置的。 |
mq_port |
消息总线使用的 TCP 端口号。默认为 5672。 |
es_port |
Elasticsearch 使用的 TCP 端口。默认为 9200。 |
es_cluster_name |
由 Elasticsearch 在高可用性场景中用于形成集群。必须使用相同的群集名称配置同一群集中的节点。默认为 NorthStar。 |
另外两个设置与收集器进程相关,但不是 northstar.cfg 的一部分。这些参数配置分析端口号,可使用 NorthStar CLI 进行配置:
如果更改端口号,则必须使用 重新启动 supervisorctl restart analytics:logstash logstash 才能使这些更改生效。
rpm-statistics-port
端口,用于读取从设备生成的系统日志消息,其中包含 RPM 统计信息的结果。默认值为 1514。要修改端口,请使用 NorthStar CLI 命令 set northstar analytics log-collector rpm-statistics-port port-number。
JTI 端口
收集器侦听来自设备的遥测数据包的 UDP 端口号。默认值为 3000。要修改端口,请使用 NorthStar CLI 命令 set northstar analytics log-collector jti-port port-number。
如果要从早于 NorthStar 4.3.0 的版本升级 NorthStar,并且使用的是 NorthStar 分析,则必须使用从 4.3 之前的 NorthStar 使用分析升级中所述的过程手动升级 NorthStar。
如果要从早于 NorthStar 6.0.0 的版本升级 NorthStar,则必须在升级 NorthStar 应用程序节点后重新部署分析设置。这是从本主题后面介绍的分析数据收集器配置设置菜单中完成的。这是为了确保 netflowd 可以与 cMGD(NorthStar CLI 所必需的)通信。
分析地理高可用性
从版本 5.1.0 开始,NorthStar 控制器支持分析异地高可用性。虽然原始分析 HA 是为本地群集(同一数据中心)设计的,但 geo-HA 使所有节点上的所有数据都可用,以便更好地为节点在地理位置上彼此相距甚远的网络提供服务。为了实现这一点,在每个分析(ElasticSearch)节点上安装了一个本地的RabbitMQ(消息传递总线)。这提高了对延迟的容忍度,并有助于补偿远程节点变得不同步的趋势。
远程 ElasticSearch 节点使用 JTI logstash 来检索和处理来自其他 ElasticSearch 节点的数据。复制管道在每个远程服务器上创建一个命名队列。队列是永久性的,因此,如果任何 ElasticSearch 节点出现故障,它可以通过恢复对推送到远程队列的数据的处理来恢复。 图 1 显示了节点内和节点之间的交互。
net_setup.py 脚本中的“分析收集器配置设置”菜单具有用于准备和部署 Geo-HA 的选项。
单服务器部署 – 无 NorthStar HA
要在单服务器部署(无 NorthStar HA)中将数据收集器和 NorthStar 应用程序一起安装,请按下列步骤操作:
在 NorthStar 应用程序节点上,使用 install.sh 脚本安装 NorthStar 控制器捆绑包。请参阅 安装 NorthStar 控制器。
在同一节点上,运行 install-analytics.sh 脚本。
[root@ns ~]# cd /opt/northstar/northstar_bundle_x.x.x/ [root@ns northstar_bundle_x.x.x]# ./install-analytics.sh groupadd: group 'pcs' already exists package NorthStar-libUtils is not installed Loaded plugins: fastestmirror Setting up Install Process Loading mirror speeds from cached hostfile northstar_bundle | 2.9 kB 00:00 ... Resolving Dependencies --> Running transaction check ---> Package NorthStar-libUtils.x86_64 0:3.1.0-20161127_68470_213 will be installed --> Finished Dependency Resolution Dependencies Resolved . . .
通过在 PC 服务器上执行 supervisorctl status 来验证是否已安装并运行三个分析进程:
[root@ns ~]# supervisorctl status analytics:elasticsearch RUNNING pid 7073, uptime 21:57:29 analytics:esauthproxy RUNNING pid 7072, uptime 21:57:29 analytics:logstash RUNNING pid 7231, uptime 21:57:26
外部分析节点 – 无 NorthStar HA
图 2 显示了一个配置示例,其中包含一个 NorthStar 应用程序节点和三个组成分析群集的分析节点。所有节点都通过 eth1 接口连接到同一个以太网网络。(可选)您可以拥有单个分析节点,而不是创建分析群集。本节中的说明涵盖单个外部分析节点和外部分析群集。
要安装一个或一组外部分析节点,请使用以下过程:
在 NorthStar 应用程序节点上,使用 install.sh 脚本安装 NorthStar 控制器应用程序。请参阅 安装 NorthStar 控制器。
在每个分析节点上,安装 northstar_bundle.rpm,但不运行 install.sh 脚本。相反,请运行 install-analytics.sh 脚本。该脚本将安装所有必需的依赖项,例如 NorthStar-JDK、NorthStar-Python 等。对于 NorthStar Analytics1,其外观如下所示:
[root@NorthStarAnalytics1]# rpm -Uvh <rpm-filename> [root@NorthStarAnalytics1]# cd /opt/northstar/northstar_bundle_x.x.x/ [root@NorthStarAnalytics1 northstar_bundle_x.x.x]# ./install-analytics.sh groupadd: group 'pcs' already exists package NorthStar-PCS is not installed Loaded plugins: fastestmirror Setting up Update Process Loading mirror speeds from cached hostfile northstar_bundle | 2.9 kB 00:00 ... No Packages marked for Update Loaded plugins: fastestmirror Setting up Update Process Loading mirror speeds from cached hostfile No Packages marked for Update Loaded plugins: fastestmirror Setting up Update Process . . .
接下来的配置步骤要求您运行 net_setup.py 脚本来配置 NorthStar 节点和分析节点,以便它们可以相互连接。但在此之前,我们建议您将要执行 net_setup.py 脚本的节点的公有 SSH 密钥复制到所有其他节点。可以在 NorthStar 应用程序节点或其中一个分析节点上运行 net_setup.py 脚本来配置所有节点。这不是必需的步骤,但它可以节省以后在脚本部署配置或测试与不同节点的连接时键入所有系统的密码的时间。
[root@NorthStarAnalytics1 network-scripts]# ssh-copy-id root@192.168.10.200 root@192.168.10.200's password:
尝试使用 登录
ssh root@192.168.10.200
计算机并使用 签入.ssh/authorized_keys
。对所有节点(在我们的示例中为 192.168.10.100、192.168.10.200、192.168.10.201 和 192.168.10.202)重复此过程。
在 NorthStar 应用程序节点或其中一个分析节点上运行 net_setup.py。主菜单显示:
Main Menu: ............................................. A.) Host Setting ............................................. B.) JunosVM Setting ............................................. C.) Check Network Setting ............................................. D.) Maintenance & Troubleshooting ............................................. E.) HA Setting ............................................. F.) Collect Trace/Log ............................................. G.) Analytics Data Collector Setting (External standalone/cluster analytics server) ............................................. H.) Setup SSH Key for external JunosVM setup ............................................. I.) Internal Analytics Setting (HA) ............................................. X.) Exit ............................................. Please select a letter to execute.
选择 G “分析数据收集器设置”。将显示“数据收集器配置设置”菜单。
Analytics Data Collector Configuration Settings: (External standalone/cluster analytics server) ******************************************************** Note: This configuration only applicable for data collector installation in separate server ******************************************************** ......................................................... NorthStar App #1 Hostname : Interface Name : external0 IPv4 : ......................................................... Analytics Collector #1 Hostname : Priority : 0 Interface Name : external0 IPv4 : 1. ) Add NorthStar App 2. ) Add analytics data collector 3. ) Modify NorthStar App 4. ) Modify analytics data collector 5A.) Remove NorthStar App 5B.) Delete NorthStar App data 6A.) Remove analytics data collector 6B.) Delete analytics data collector data .......................................................... 7A.) Virtual IP for Northstar App : 7B.) Delete Virtual IP for Northstar App 8A.) Virtual IP for Analytics Collector : 8B.) Delete Virtual IP for Analytics Collector .......................................................... 9. ) Test Analytics Data Collector Connectivity A. ) Prepare and Deploy SINGLE Data Collector Setting B. ) Prepare and Deploy HA Analytics Data Collector Setting C. ) Prepare and Deploy GEO-HA Analytics Data Collector Setting D. ) Copy Collector setting to other nodes E. ) Add a new Collector node to existing cluster F. ) Sync Config with NorthStar App .......................................................... Please select a number to modify. [<CR>=return to main menu]:
从“数据收集器配置设置”菜单中选择选项以进行以下配置更改:
选择此选项 3 可修改 NorthStar 应用程序节点设置,并配置 NorthStar 服务器名称和 IP 地址。例如:
Please select a number to modify. [CR=return to main menu]: 3 NorthStar App ID : 1 current NorthStar App #1 hostname (without domain name) : new NorthStar App #1 hostname (without domain name) : NorthStarAppServer current NorthStar App #1 interface name : external0 new NorthStar App #1 interface name : eth1 current NorthStar App #1 interface IPv4 address : new NorthStar App #1 interface IPv4 address : 192.168.10.100 Press any key to return to menu
选择此选项 4 可修改分析节点 IP 地址。例如:
Please select a number to modify. [CR=return to main menu]: 4 Collector ID : 1 current collector #1 hostname (without domain name) : new collector #1 hostname (without domain name) : NorthStarAnalytics1 current collector #1 node priority : 0 new collector #1 node priority : 10 current collector #1 interface name : external0 new collector #1 interface name : eth1 current collector #1 interface IPv4 address : new collector #1 interface IPv4 address : 192.168.10.200 Press any key to return to menu
选择 2 以根据需要添加其他分析节点。在我们的分析群集示例中,将添加两个额外的分析节点:
Please select a number to modify. [CR=return to main menu]: 2 New collector ID : 2 current collector #2 hostname (without domain name) : new collector #2 hostname (without domain name) : NorthStarAnalytics2 current collector #2 node priority : 0 new collector #2 node priority : 20 current collector #2 interface name : external0 new collector #2 interface name : eth1 current collector #2 interface IPv4 address : new collector #2 interface IPv4 address : 192.168.10.201 Press any key to return to menu Please select a number to modify. [CR=return to main menu]: 2 New collector ID : 3 current collector #3 hostname (without domain name) : new collector #3 hostname (without domain name) : NorthStarAnalytics3 current collector #3 node priority : 0 new collector #3 node priority : 30 current collector #3 interface name : external0 new collector #3 interface name : eth1 current collector #3 interface IPv4 address : new collector #3 interface IPv4 address : 192.168.10.202 Press any key to return to menu
选择此选项 8A 可为分析节点群集配置 VIP 地址。如果您有分析群集,则这是必需的。如果只有一个外部分析节点(不是群集),则可以跳过此步骤。
Please select a number to modify. [CR=return to main menu]: 8A current Virtual IP for Collector : new Virtual IP for Collector : 192.168.10.250 Press any key to return to menu
此 VIP 有两个目的:
它允许 NorthStar 服务器将查询发送到单个端点。VIP 将在其中一个分析节点上处于活动状态,并在发生故障(全节点故障或分析节点上运行的任何进程出现故障)时切换。
设备可以将遥测数据发送到 VIP,确保如果分析节点发生故障,遥测数据仍可由取得 VIP 所有权的非故障节点进行处理。
分析群集示例的配置现在应如下所示:
Analytics Data Collector Configuration Settings: (External standalone/cluster analytics server) ******************************************************** Note: This configuration only applicable for analytics data collector installation in separate server ******************************************************** ......................................................... NorthStar App #1 Hostname : NorthStarAppServer Interface Name : eth1 IPv4 : 192.168.10.100 ......................................................... Analytics Collector #1 Hostname : NorthStarAnalytics1 Priority : 10 Interface Name : eth1 IPv4 : 192.168.10.200 Analytics Collector #2 Hostname : NorthStarAnalytics2 Priority : 20 Interface Name : eth1 IPv4 : 192.168.10.201 Analytics Collector #3 Hostname : NorthStarAnalytics3 Priority : 30 Interface Name : eth1 IPv4 : 192.168.10.202 1. ) Add NorthStar App 2. ) Add analytics data collector 3. ) Modify NorthStar App 4. ) Modify analytics data collector 5A.) Remove NorthStar App 5B.) Delete NorthStar App data 6A.) Remove analytics data collector 6B.) Delete analytics data collector data .......................................................... 7A.) Virtual IP for Northstar App : 7B.) Delete Virtual IP for Northstar App 8A.) Virtual IP for Analytics Collector : 192.168.10.250 8B.) Delete Virtual IP for Analytics Collector .......................................................... 9. ) Test Analytics Data Collector Connectivity A. ) Prepare and Deploy SINGLE Data Collector Setting B. ) Prepare and Deploy HA Analytics Data Collector Setting C. ) Prepare and Deploy GEO-HA Analytics Data Collector Setting D. ) Copy Collector setting to other nodes E. ) Add a new Collector node to existing cluster F. ) Sync Config with NorthStar App .......................................................... Please select a number to modify. [<CR>=return to main menu]:
选择此选项 9 可测试节点之间的连接。这适用于您拥有外部分析节点(无论是只有一个节点还是其中一个群集)的情况。例如:
Please select a number to modify. [CR=return to main menu]: 9 Validate NorthStar App configuration interface Validate Collector configuration interface Verifying the NorthStar version on each NorthStar App node: NorthStar App #1 NorthStarAppServer: NorthStar-Bundle-3.1.0-20170517_195239_70090_547.x86_64 Collector #1 NorthStarAnalytics1 : NorthStar-Bundle-3.1.0-20170517_195239_70090_547.x86_64 Collector #2 NorthStarAnalytics2 : NorthStar-Bundle-3.1.0-20170517_195239_70090_547.x86_64 Collector #3 NorthStarAnalytics3 : NorthStar-Bundle-3.1.0-20170517_195239_70090_547.x86_64 Checking NorthStar App connectivity... NorthStar App #1 interface name eth1 ip 192.168.10.100: OK Checking collector connectivity... Collector #1 interface name eth1 ip 192.168.10.200: OK Collector #2 interface name eth1 ip 192.168.10.201: OK Collector #3 interface name eth1 ip 192.168.10.202: OK Press any key to return to menu
选择(对于单个分析节点)、 B (对于分析群集)或C对于分析地理 HA,以A配置要部署的节点。
注意:此选项将重新启动 NorthStar 应用程序节点中的 Web 进程。
对于我们的示例,请选择 B:
Please select a number to modify. [CR=return to main menu]: B Setup mode set to "cluster" Validate NorthStar App configuration interface Validate Collector configuration interface Verifying the NorthStar version on each NorthStar App node: NorthStar App #1 NorthStarAppServer: NorthStar-Bundle-3.1.0-20170517_195239_70090_547.x86_64 Verifying the NorthStar version on each Collector node: Collector #1 NorthStarCollector1 : NorthStar-Bundle-3.1.0-20170517_195239_70090_547.x86_64 Collector #2 NorthStarCollector2 : NorthStar-Bundle-3.1.0-20170517_195239_70090_547.x86_64 Collector #3 NorthStarCollector3 : NorthStar-Bundle-3.1.0-20170517_195239_70090_547.x86_64 WARNING ! The selected menu will restart nodejs process in Northstar App node Type YES to continue... YES Checking NorthStar App connectivity... NorthStar App #1 interface name eth1 ip 192.168.10.100: OK Checking collector connectivity... Collector #1 interface name eth1 ip 192.168.10.200: OK Collector #2 interface name eth1 ip 192.168.10.201: OK Collector #3 interface name eth1 ip 192.168.10.202: OK Checking analytics process in NorthStar App node ... Detected analytics is not in NorthStar App node #1: OK Checking analytics process in collector node ... Detected analytics in collector node #1: OK Detected analytics in collector node #2: OK Detected analytics in collector node #3: OK External data collector set to "yes" Sync configuration for NorthStar App #1: OK Sync configuration for Collector #1: OK Sync configuration for Collector #2: OK Sync configuration for Collector #3: OK Preparing collector #1 basic configuration .. Uploading config files to collector01 Preparing collector #2 basic configuration .. Uploading config files to collector02 Preparing collector #3 basic configuration .. Uploading config files to collector03 Applying data collector config files Applying data collector config files at NorthStar App Deploying NorthStar App #1 collector configuration ... Applying data collector config files at collector Deploying collector #1 collector configuration ... Deploying collector #2 collector configuration ... Deploying collector #3 collector configuration ... Deploying collector #1 zookeeper configuration ... Wait 2 minutes before adding new node ...10 seconds ...20 seconds ...30 seconds ...40 seconds ...50 seconds ...60 seconds ...70 seconds ...80 seconds ...90 seconds ...100 seconds ...110 seconds Deploying collector #2 zookeeper configuration ... Wait 2 minutes before adding new node ...10 seconds ...20 seconds ...30 seconds ...40 seconds ...50 seconds ...60 seconds ...70 seconds ...80 seconds ...90 seconds ...100 seconds ...110 seconds Deploying collector #3 zookeeper configuration ... Restart ZooKeeper at collector #1 collector01 Restart ZooKeeper at collector #2 collector02 Restart ZooKeeper at collector #3 collector03 Restart Analytics at collector #1 collector01 Restart Analytics at collector #2 collector02 Restart Analytics at collector #3 collector03 Restart HA Agent at collector #1 collector01 Please wait for HA Agent process initialization ...10 seconds ...20 seconds Restart HA Agent at collector #2 collector02 Please wait for HA Agent process initialization ...10 seconds ...20 seconds Restart HA Agent at collector #3 collector03 Please wait for HA Agent process initialization ...10 seconds ...20 seconds Restart Nodejs at Northstar App #1 pcs Collector configurations has been applied successfully Press any key to return to menu
这样就完成了安装,遥测数据现在可以通过分析 VIP 发送到分析节点。
注意:如果选择将遥测数据发送到单个节点,而不是使用分析群集的 VIP,并且该节点出现故障,则到该节点的流将丢失。如果您选择仅安装一个分析节点,而不是使用 VIP 的分析集群,则会遇到相同的风险。
外部分析节点 – 使用 NorthStar HA
图 3 显示了一个示例配置,其中包含一个包含三个节点的 NorthStar HA 群集和由一个分析群集组成的三个分析节点,总共六个节点。所有节点都通过 eth1 接口连接到同一个以太网网络。在 NorthStar HA 环境中,您还可以选择使用单个分析节点(总共四个节点),但如果分析节点发生故障,分析收集将不受保护。
对于此方案,您首先根据 配置 NorthStar 群集以实现高可用性中的说明配置 NorthStar 应用程序 HA 群集。
配置 NorthStar HA 群集后,设置外部分析群集。外部分析群集的设置步骤与上一节 外部分析节点 – 无 NorthStar HA 中的步骤完全相同。完成这些操作后,配置应如下所示:
Analytics Data Collector Configuration Settings: (External standalone/cluster analytics server) ******************************************************** Note: This configuration only applicable for analytics data collector installation in separate server ******************************************************** ......................................................... NorthStar App #1 Hostname : NorthStarAppServer1 Interface Name : eth1 IPv4 : 192.168.10.100 NorthStar App #2 Hostname : NorthStarAppServer2 Interface Name : eth1 IPv4 : 192.168.10.101 NorthStar App #3 Hostname : NorthStarAppServer3 Interface Name : eth1 IPv4 : 192.168.10.102 ......................................................... Analytics Collector #1 Hostname : NorthStarAnalytics1 Priority : 10 Interface Name : eth1 IPv4 : 192.168.10.200 Analytics Collector #2 Hostname : NorthStarAnalytics2 Priority : 20 Interface Name : eth1 IPv4 : 192.168.10.201 Analytics Collector #3 Hostname : NorthStarAnalytics3 Priority : 30 Interface Name : eth1 IPv4 : 192.168.10.202 1. ) Add NorthStar App 2. ) Add analytics data collector 3. ) Modify NorthStar App 4. ) Modify analytics data collector 5A.) Remove NorthStar App 5B.) Delete NorthStar App data 6A.) Remove analytics data collector 6B.) Delete analytics data collector data .......................................................... 7A.) Virtual IP for Northstar App : 192.168.10.249 7B.) Delete Virtual IP for Northstar App 8A.) Virtual IP for Analytics Collector : 192.168.10.250 8B.) Delete Virtual IP for Analytics Collector .......................................................... 9. ) Test Analytics Data Collector Connectivity A. ) Prepare and Deploy SINGLE Data Collector Setting B. ) Prepare and Deploy HA Analytics Data Collector Setting C. ) Prepare and Deploy GEO-HA Analytics Data Collector Setting D. ) Copy Collector setting to other nodes E. ) Add a new Collector node to existing cluster F. ) Sync Config with NorthStar App .......................................................... Please select a number to modify. [<CR>=return to main menu]:
通过从菜单中选择来 9 测试节点之间的连接。
通过选择 B HA 分析或 C Geo-HA 分析来配置要部署的节点。这将重新启动 NorthStar 应用程序节点中的 Web 进程。
在具有外部分析节点时验证数据收集
通过检查所有服务是否都在运行来验证数据收集是否正常工作。下面仅显示相关流程。
[root@NorthStarAnalytics1 ~]# supervisorctl status analytics:elasticsearch RUNNING pid 4406, uptime 0:02:06 analytics:esauthproxy RUNNING pid 4405, uptime 0:02:06 analytics:logstash RUNNING pid 4407, uptime 0:02:06 infra:ha_agent RUNNING pid 4583, uptime 0:00:19 infra:healthmonitor RUNNING pid 3491, uptime 1:01:09 infra:zookeeper RUNNING pid 4324, uptime 0:03:16 listener1:listener1_00 RUNNING pid 4325, uptime 0:03:16
分析节点应开始处理来自网络的所有记录,并通过 RabbitMQ 将统计信息推送到 NorthStar 节点。检查 NorthStar 节点中的 pcs.log,查看推送到 PC 服务器的统计信息。例如:
11-28T13:18:02.174126 30749 PCServer [NorthStar][PCServer][<-AMQP] msg=0x00004018 routing_key = ns_tunnel_traffic 11-28T13:18:02.174280 30749 PCServer [NorthStar][PCServer][Traffic] msg=0x00005004 EF1-PE1-PE2@PE1 111094 11-28T13:18:02.174429 30749 PCServer [NorthStar][PCServer][Traffic] msg=0x00005004 EF1-PE1-PE3@PE1 824 11-28T13:18:02.174764 30749 PCServer [NorthStar][PCServer][Traffic] msg=0x00005004 CS1-PE3-PE3@PE3 0 11-28T13:18:02.174930 30749 PCServer [NorthStar][PCServer][Traffic] msg=0x00005004 CS2-PE3-PE2@PE3 0 11-28T13:18:02.175067 30749 PCServer [NorthStar][PCServer][Traffic] msg=0x00005004 EF2-PE3-PE3@PE3 0 11-28T13:18:02.175434 30749 PCServer [NorthStar][PCServer][Traffic] msg=0x00005004 EF2-PE3-PE1@PE3 0 11-28T13:18:02.175614 30749 PCServer [NorthStar][PCServer][Traffic] msg=0x00005004 EF1-PE3-PE1@PE3 0 11-28T13:18:02.175749 30749 PCServer [NorthStar][PCServer][Traffic] msg=0x00005004 CS2-PE3-PE3@PE3 0 11-28T13:18:02.175873 30749 PCServer [NorthStar][PCServer][Traffic] msg=0x00005004 CS1-PE3-PE1@PE3 0 11-28T13:18:02.175989 30749 PCServer [NorthStar][PCServer][Traffic] msg=0x00005004 CS1-PE3-PE2@PE3 0 11-28T13:18:02.176128 30749 PCServer [NorthStar][PCServer][Traffic] msg=0x00005004 CS2-PE3-PE1@PE3 824 11-28T13:18:02.176256 30749 PCServer [NorthStar][PCServer][Traffic] msg=0x00005004 EF1-PE3-PE3@PE3 0 11-28T13:18:02.176393 30749 PCServer [NorthStar][PCServer][Traffic] msg=0x00005004 EF1-PE2-PE1@PE2 112552 11-28T13:18:02.176650 30749 PCServer [NorthStar][PCServer][Traffic] msg=0x00005004 AF1-PE2-PE1@PE2 0 11-28T13:18:02.176894 30749 PCServer [NorthStar][PCServer][Traffic] msg=0x00005004 AF2-PE2-PE1@PE2 0 11-28T13:18:02.177059 30749 PCServer [NorthStar][PCServer][Traffic] msg=0x00005004 EF12-PE2-PE1@PE2 0
还可以使用 REST API 获取一些聚合统计信息。这将测试从客户端到 nodejs 再到 Elasticsearch 的路径。
curl --insecure -X POST -H "Authorization: Bearer 7IEvYhvABrae6m1AgI+zi4V0n7UiJNA2HqliK7PfGhY=" -H "Content-Type: application/json" -d '{ "endTime": "now", "startTime": "now-1h", "aggregation": "avg", "counter": "interface_stats.egress_stats.if_bps" }' "https://localhost:8443/NorthStar/API/v2/tenant/1/statistics/device/top" [ { "id": { "statisticType": "device", "name": "vmx105", "node": { "topoObjectType": "node", "hostName": "vmx105" } }, "interface_stats.egress_stats.if_bps": 525088 }, { "id": { "statisticType": "device", "name": "PE1", "node": { "topoObjectType": "node", "hostName": "PE1" } }, "interface_stats.egress_stats.if_bps": 228114 }, { "id": { "statisticType": "device", "name": "PE2", "node": { "topoObjectType": "node", "hostName": "PE2" } }, "interface_stats.egress_stats.if_bps": 227747 }, { "id": { "statisticType": "device", "name": "PE3", "node": { "topoObjectType": "node", "hostName": "PE3" } }, "interface_stats.egress_stats.if_bps": 6641 }, { "id": { "statisticType": "device", "name": "PE4", "node": { "topoObjectType": "node", "hostName": "PE4" } }, "interface_stats.egress_stats.if_bps": 5930 } ]
替换外部分析群集中的故障节点
在“数据收集器配置设置”菜单上,在物理替换故障节点时,可以使用选项 D 和 E。它们允许您替换节点,而无需重新部署整个群集。
在三节点群集中替换节点时,无法保证分析数据的 HA。
更换网络中的物理节点,并在替换节点上安装 northstar_bundle.rpm。在我们的示例中,替换节点是 NorthStarAnalytics3。
运行 install-analytics.sh 脚本以安装所有必需的依赖项,例如 NorthStar-JDK、NorthStar-Python 等。对于 NorthStarAnalytics3,它看起来像这样:
[root@NorthStarAnalytics3]# rpm -Uvh <rpm-filename> [root@NorthStarAnalytics3]# cd /opt/northstar/northstar_bundle_x.x.x/ [root@NorthStarAnalytics3 northstar_bundle_x.x.x]# ./install-analytics.sh groupadd: group 'pcs' already exists package NorthStar-PCS is not installed Loaded plugins: fastestmirror Setting up Update Process Loading mirror speeds from cached hostfile northstar_bundle | 2.9 kB 00:00 ... No Packages marked for Update Loaded plugins: fastestmirror Setting up Update Process Loading mirror speeds from cached hostfile No Packages marked for Update Loaded plugins: fastestmirror Setting up Update Process . . .
设置从锚节点到替换节点的 SSH 密钥。锚点节点可以是 NorthStar 应用程序节点,也可以是其中一个分析群集节点(替换节点除外)。将公有 SSH 密钥从锚点节点复制到替换节点,从替换节点复制到其他节点(NorthStar 应用程序节点和分析群集节点),从其他节点(NorthStar 应用程序节点和分析群集节点)复制到替换节点。
例如:
[root@NorthStarAnalytics1 network-scripts]# ssh-copy-id root@192.168.10.202 root@192.168.10.202's password:
尝试使用 登录
ssh root@192.168.10.202
计算机并使用 签入.ssh/authorized_keys
。在所选节点上运行 net_setup.py。主菜单显示:
Main Menu: ............................................. A.) Host Setting ............................................. B.) JunosVM Setting ............................................. C.) Check Network Setting ............................................. D.) Maintenance & Troubleshooting ............................................. E.) HA Setting ............................................. F.) Collect Trace/Log ............................................. G.) Analytics Data Collector Setting (External standalone/cluster analytics server) ............................................. H.) Setup SSH Key for external JunosVM setup ............................................. I.) Internal Analytics Setting (HA) ............................................. X.) Exit ............................................. Please select a letter to execute.
选择 G “数据收集器设置”。将显示“数据收集器配置设置”菜单。
Analytics Data Collector Configuration Settings: (External standalone/cluster analytics server) ******************************************************** Note: This configuration only applicable for analytics data collector installation in separate server ******************************************************** ......................................................... NorthStar App #1 Hostname : NorthStarAppServer1 Interface Name : eth1 IPv4 : 192.168.10.100 ......................................................... NorthStar App #2 Hostname : NorthStarAppServer2 Interface Name : eth1 IPv4 : 192.168.10.101 ......................................................... NorthStar App #3 Hostname : NorthStarAppServer3 Interface Name : eth1 IPv4 : 192.168.10.102 ......................................................... Analytics Collector #1 Hostname : NorthStarAnalytics1 Priority : 10 Interface Name : eth1 IPv4 : 192.168.10.200 ......................................................... Analytics Collector #2 Hostname : NorthStarAnalytics2 Priority : 20 Interface Name : eth1 IPv4 : 192.168.10.201 ......................................................... Analytics Collector #3 Hostname : NorthStarAnalytics3 Priority : 30 Interface Name : eth1 IPv4 : 192.168.10.202 1. ) Add NorthStar App 2. ) Add analytics data collector 3. ) Modify NorthStar App 4. ) Modify analytics data collector 5A.) Remove NorthStar App 5B.) Delete NorthStar App data 6A.) Remove analytics data collector 6B.) Delete analytics data collector data .......................................................... 7A.) Virtual IP for Northstar App : 192.168.10.249 7B.) Delete Virtual IP for Northstar App 8A.) Virtual IP for Collector : 192.168.10.250 8B.) Delete Virtual IP for Analytics Collector .......................................................... 9. ) Test Analytics Data Collector Connectivity A. ) Prepare and Deploy SINGLE Data Collector Setting B. ) Prepare and Deploy HA Analytics Data Collector Setting C. ) Prepare and Deploy GEO-HA Analytics Data Collector Setting D. ) Copy Collector setting to other nodes E. ) Add a new Collector node to existing cluster F. ) Sync Config with NorthStar App .......................................................... Please select a number to modify. [<CR>=return to main menu]:
选择选项 9 以测试与所有 NorthStar 应用程序节点和分析群集节点的连接。
Checking NorthStar App connectivity... NorthStar App #1 interface name eth1 ip 192.168.10.100: OK NorthStar App #2 interface name eth1 ip 192.168.10.101: OK NorthStar App #3 interface name eth1 ip 192.168.10.102: OK Checking collector connectivity... Collector #1 interface name eth1 ip 192.168.10.200: OK Collector #2 interface name eth1 ip 192.168.10.201: OK Collector #3 interface name eth1 ip 192.168.10.202: OK
选择选项 D 以将分析设置复制到其他节点。
Validate NorthStar App configuration interface Validate Collector configuration interface Verifying the NorthStar version on each NorthStar App node: NorthStar App #1 NorthStarAppServer1 : NorthStar-Bundle-3.1.0-20170517_195239_70090_547.x86_64 NorthStar App #2 NorthStarAppServer2 : NorthStar-Bundle-3.1.0-20170517_195239_70090_547.x86_64 NorthStar App #3 NorthStarAppServer3 : NorthStar-Bundle-3.1.0-20170517_195239_70090_547.x86_64 Verifying the NorthStar version on each Collector node: Collector #1 NorthStarAnalytics1 : NorthStar-Bundle-3.1.0-20170517_195239_70090_547.x86_64 Collector #2 NorthStarAnalytics2 : NorthStar-Bundle-3.1.0-20170517_195239_70090_547.x86_64 Collector #3 NorthStarAnalytics3 : NorthStar-Bundle-3.1.0-20170517_195239_70090_547.x86_64 Checking NorthStar App connectivity... NorthStar App #1 interface name eth1 ip 192.168.10.100: OK NorthStar App #2 interface name eth1 ip 192.168.10.101: OK NorthStar App #3 interface name eth1 ip 192.168.10.102: OK Checking collector connectivity... Collector #1 interface name eth1 ip 192.168.10.200: OK Collector #2 interface name eth1 ip 192.168.10.201: OK Collector #3 interface name eth1 ip 192.168.10.202: OK Sync configuration for NorthStar App #1: OK Sync configuration for NorthStar App #2: OK Sync configuration for NorthStar App #3: OK Sync configuration for Collector #1: OK Sync configuration for Collector #2: OK Sync configuration for Collector #3: OK
选择选项 E 以将替换节点添加到群集。指定替换节点的节点 ID。
在任何分析集群节点上,使用以下命令检查 Elasticsearch 集群状态。验证状态是否为“绿色”且节点数是否正确。
[root@NorthStarAnalytics1]# curl -XGET 'localhost:9200/_cluster/health?pretty' { "cluster_name" : "NorthStar", "status" : "green", "timed_out" : false, "number_of_nodes" : 3, "number_of_data_nodes" : 3, "active_primary_shards" : 10, "active_shards" : 10, "relocating_shards" : 0, "initializing_shards" : 0, "unassigned_shards" : 0, "delayed_unassigned_shards" : 0, "number_of_pending_tasks" : 0, "number_of_in_flight_fetch" : 0, "task_max_waiting_in_queue_millis" : 0, "active_shards_percent_as_number" : 100.0 }
安装在 NorthStar HA 群集节点上的收集器
在 NorthStar HA 环境中,通过将 NorthStar 群集中的每个节点也设置为分析节点,可以同时为 NorthStar 应用程序和分析实现故障转移保护。由于 NorthStar 群集外部没有任何内容,因此您的节点总数为 NorthStar 群集中的数量(最少三个)。 图 4 显示了此安装方案。
若要设置此方案,请首先在每个独立节点上安装 NorthStar 应用程序和分析,将节点配置为 HA 群集,最后将节点配置为分析群集。请按照下列步骤操作:
在每个 NorthStar 应用程序节点上,使用 install.sh 脚本安装 NorthStar 控制器应用程序。请参阅 安装 NorthStar 控制器。
在每个节点上,安装 northstar_bundle.rpm,然后运行 install-analytics.sh 脚本。该脚本将安装所有必需的依赖项,例如 NorthStar-JDK、NorthStar-Python 等。对于示例中的节点 ns03,它如下所示:
[root@ns03]# rpm -Uvh <rpm-filename> [root@ns03]# cd /opt/northstar/northstar_bundle_x.x.x/ [root@ns03 northstar_bundle_x.x.x]# ./install-analytics.sh groupadd: group 'pcs' already exists package NorthStar-PCS is not installed Loaded plugins: fastestmirror Setting up Update Process Loading mirror speeds from cached hostfile northstar_bundle | 2.9 kB 00:00 ... No Packages marked for Update Loaded plugins: fastestmirror Setting up Update Process Loading mirror speeds from cached hostfile No Packages marked for Update Loaded plugins: fastestmirror Setting up Update Process . . .
在每个节点上使用以下命令以确保已安装并运行三个分析进程:
[root@ns03 ~]# supervisorctl status | grep analytics:* analytics:elasticsearch RUNNING pid 16238, uptime 20:58:37 analytics:esauthproxy RUNNING pid 16237, uptime 20:58:37 analytics:logstash RUNNING pid 3643, uptime 20:13:08
按照配置 NorthStar 群集以实现高可用性 中的说明为 NorthStar HA 配置节点。这涉及运行 net_setup.py 实用程序,选择访问 E HA 设置菜单,以及使用该菜单完成 HA 设置步骤。
从 HA 设置菜单中,按 返回 Enter 主 net_setup.py 菜单。主菜单显示:
Main Menu: ............................................. A.) Host Setting ............................................. B.) JunosVM Setting ............................................. C.) Check Network Setting ............................................. D.) Maintenance & Troubleshooting ............................................. E.) HA Setting ............................................. F.) Collect Trace/Log ............................................. G.) Data Collector Setting (External standalone/cluster analytics server) ............................................. H.) Setup SSH Key for external JunosVM setup ............................................. I.) Internal Analytics Setting (HA) ............................................. X.) Exit ............................................. Please select a letter to execute.
选择以 I 继续。此菜单选项应用您已经为 NorthStar HA 群集配置的设置,因此您无需进行任何更改。
Internal Analytics Configuration HA Settings: ******************************************************** Note: This configuration only applicable for analytics installation in the same server ******************************************************** .......................................................... Node #1 Hostname : ns03 Priority : 10 Cluster Communication Interface : eth2 Cluster Communication IP : 172.16.18.13 Interfaces Interface #1 Name : eth2 IPv4 : 172.16.18.13 Switchover : yes Interface #2 Name : mgmt0 IPv4 : Switchover : yes Interface #3 Interface #4 Interface #5 Node #2 Hostname : ns04 Priority : 20 Cluster Communication Interface : eth2 Cluster Communication IP : 172.16.18.14 Interfaces Interface #1 Name : eth2 IPv4 : 172.16.18.14 Switchover : yes Interface #2 Name : mgmt0 IPv4 : Switchover : yes Interface #3 Interface #4 Interface #5 Node #3 Hostname : ns05 Priority : 30 Cluster Communication Interface : eth2 Cluster Communication IP : 172.16.18.15 Interfaces Interface #1 Name : eth2 IPv4 : 172.16.18.15 Switchover : yes Interface #2 Name : mgmt0 IPv4 : Switchover : yes Interface #3 Interface #4 Interface #5 .......................................................... 1.) Prepare and Deploy Internal Analytics HA configs .......................................................... Please select a number to modify. [<CR>=return to main menu]:
注意:根据节点的地理位置,您可能希望使用分析地理 HA,而不是设置内部分析。在这种情况下,您可以选择访问分析数据收集器配置设置,而不是G选择 I。更新这些设置后,选择(C准备和部署 GEO-HA 分析数据收集器设置)。下面的步骤7将不适用。
选择以 1 设置 NorthStar HA 群集进行分析。
WARNING ! The selected menu will restart analytics processes in each cluster member Type YES to continue... YES Checking connectivity of cluster_communication_interface... Cluster communications status for node ns03 cluster interface eth2 ip 172.16.18.13: OK Cluster communications status for node ns04 cluster interface eth2 ip 172.16.18.14: OK Cluster communications status for node ns05 cluster interface eth2 ip 172.16.18.15: OK Verifying the NorthStar version on each node: ns03 : NorthStar-Bundle-18.1.0-20180412_071430_72952_187.x86_64 ns04 : NorthStar-Bundle-18.1.0-20180412_071430_72952_187.x86_64 ns05 : NorthStar-Bundle-18.1.0-20180412_071430_72952_187.x86_64 Checking analytics process in each node ... Detected analytics in node #1 ns03: OK Detected analytics in node #2 ns04: OK Detected analytics in node #3 ns05: OK Applying analytics config files Deploying analytics configuration in node #1 ns03 Deploying analytics configuration in node #2 ns04 Deploying analytics configuration in node #3 ns05 Restart Analytics at node #1 ns03 Restart Analytics at node #2 ns04 Restart Analytics at node #3 ns05 Internal analytics configurations has been applied successfully Press any key to return to menu
在任何分析节点上,使用以下命令检查 elasticsearch 集群状态。验证状态是否为“绿色”且节点数是否正确。
[root@ns03 ~]# curl -XGET 'localhost:9200/_cluster/health?pretty' { "cluster_name" : "NorthStar", "status" : "green", "timed_out" : false, "number_of_nodes" : 3, "number_of_data_nodes" : 3, "active_primary_shards" : 10, "active_shards" : 10, "relocating_shards" : 0, "initializing_shards" : 0, "unassigned_shards" : 0, "delayed_unassigned_shards" : 0, "number_of_pending_tasks" : 0, "number_of_in_flight_fetch" : 0, "task_max_waiting_in_queue_millis" : 0, "active_shards_percent_as_number" : 100.0 }
日志故障排除
以下日志可用于帮助进行故障排除:
/opt/northstar/logs/elasticsearch.msg
/opt/northstar/logs/logstash.msg
/opt/northstar/logs/logstash.log
有关详细信息,请参阅 NorthStar 控制器用户指南中的日志。