手工调整了em内嵌的绿色版本lightdb监控端口引发的问题解决

术语说明

  1. em:LightDBEnterprise Manager(即LightDB数据库监控管理平台,下文均简称为LightDB EM)是一个综合性的数据库监控和管理系统,旨在满足数据库用户的需求,提供强大的图形界面,简化了对LightDB数据库的维护和使用。

  1. em_install_path: em家目录,比如/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em,em家目录结构如下:

├── em
    ├── bin         EM可执行文件
    ├── backup      备份脚本
    ├── collect     EM采集脚本
    ├── database    安装数据库文件
    ├── installer   数据库zip文件
    ├── config      EM配置
    ├── logs        EM日志
    ├── scripts     EM脚本
    ├── redis       redis执行文件
    ├── gotty       gotty执行文件
    ├── nginx       nginx执行文件
    ├── upload      上传的agent文件
    ├── tmp         em备份脚本
    └── upgrade     EM增量及全量SQL
  1. LTDATA:em内嵌的绿色版本lightdb(13.8-22.4)的DATA目录,比如/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4/data

  1. 绿色版本的lightdb数据库:作为em的数据库,内嵌到em的安装包中,可以直接启动lt_ctl start -D $LTDATA,绿色版本的lightdb数据库已完成数据库初始化和em的业务库em的初始化

正常启动em和em内嵌的绿色版本ligthdb数据库

  1. lightdb官网em下载地址选择em安装包下载到本地

  1. 将em安装包上传到本地虚拟机并解压缩(unzip)

[lightdb@192_168_76_128 ~]$ unzip lightdb-em-13.8-22.4-932edbddb-el7.x86_64.zip
Archive:  lightdb-em-13.8-22.4-932edbddb-el7.x86_64.zip
   creating: lightdb-em-13.8-22.4-932edbddb-el7.x86_64/
   creating: lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/
   creating: lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/config/
  inflating: lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/config/log4j2.xml
   creating: lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/config/service/
   creating: lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/config/service/mybatis/
  inflating: lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/config/service/mybatis/mybatis.cfg.xml
  inflating: lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/config/jrescloud.properties
   creating: lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/collect/
...
  1. 参考em提供的EM-README.md内容修改em配置文件${em_install_path}/config/jrescloud.properties并一键启动em,验证em启动成功

[lightdb@192_168_76_128 config]$ pwd
/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/config
[lightdb@192_168_76_128 config]$ ls -l
总用量 8
-rwxr-xr-x 1 lightdb lightdb 3825 1月  12 20:17 jrescloud.properties
-rwxr-xr-x 1 lightdb lightdb 3925 1月  12 20:17 log4j2.xml
drwxr-xr-x 3 lightdb lightdb   21 1月  12 20:17 service
#替换文件jrescloud.properties中占位符${install_path},${em_host},${app.web.domain}
[lightdb@192_168_76_128 config]$ sed -i 's/${app.web.domain}/192.168.76.128/' jrescloud.properties
[lightdb@192_168_76_128 config]$ sed -i 's/${em_host}/192.168.76.128/' jrescloud.properties
[lightdb@192_168_76_128 config]$ pwd
/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/config
[lightdb@192_168_76_128 config]$ sed -i 's!${install_path}!/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em!' jrescloud.properties

# 一键启动em
[lightdb@192_168_76_128 scripts]$ pwd
/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/scripts
[lightdb@192_168_76_128 scripts]$ ./start_all.sh
log path: /home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/redis/redis.log
15:37:13 em_start.sh kill old em process and green lightdb instance process first
15:37:13 em_stop.sh green LTBASE: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em]
15:37:13 em_stop.sh green LTHOME: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4]
15:37:13 em_stop.sh green LTDATA: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4/data]
15:37:13 em_stop.sh No green lightdb instance process !!!
 15:37:13 em_start.sh GREEN_LIGHTDB_VERSION : 13.8-22.4
15:37:13 em_start.sh LTHOME: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4]
15:37:13 em_start.sh LTDATA: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4/data]
15:37:13 em_start.sh checking green lightdb instance process whether started or not....
15:37:13 em_start.sh LTDATA :/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4/data] not occupy. now start green lightdb instance
waiting for server to start....2023-01-30 15:37:13.650808T,,,,,postmaster,,00000,2023-01-30 15:37:13 CST,0,55289,LOG:  requesting named LWLockTranch for canopy_query_stats
2023-01-30 15:37:13.654981T,,,,,postmaster,,00000,2023-01-30 15:37:13 CST,0,55289,LOG:  LightDB autoprewarm: prewarm dbnum=0
2023-01-30 15:37:13.658276T,,,,,postmaster,,00000,2023-01-30 15:37:13 CST,0,55289,INFO:  invoking IpcMemoryCreate(size=440696832)
2023-01-30 15:37:14.270121T,,,,,postmaster,,00000,2023-01-30 15:37:13 CST,0,55289,LOG:  redirecting log output to logging collector process
2023-01-30 15:37:14.270121T,,,,,postmaster,,00000,2023-01-30 15:37:13 CST,0,55289,HINT:  Future log output will appear in directory "log".
 done
server started
15:37:14 em_start.sh start green lightdb instance sucess and prepare start em process
15:37:14 em_start.sh now  start em process...
15:37:14 em_start.sh em log path: /home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/logs
/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/scripts
/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/scripts
log path: /home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/gotty/gotty.log

# 查看em启动日志
[lightdb@192_168_76_128 logs]$ tail -fn500 lightdb-em.log
2023-01-30 15:38:03.297,main,ERROR,com.hundsun.lightdb.manager.SpringScheduledTask,定时任务添加成功 [192.168.76.128] [17333] [com.hundsun.lightdb.manager.service.impl.database.CleanDataTask]
2023-01-30 15:38:03.300,main,ERROR,com.hundsun.lightdb.manager.SpringScheduledTask,定时任务添加成功 [192.168.76.128] [17333] [com.hundsun.lightdb.manager.service.impl.database.DbLogKeyWordsTask]
2023-01-30 15:38:03.303,main,ERROR,com.hundsun.lightdb.manager.SpringScheduledTask,定时任务添加成功 [192.168.76.128] [17333] [com.hundsun.lightdb.manager.service.impl.heartbeat.HeartBeatTask]
2023-01-30 15:38:03.307,main,ERROR,com.hundsun.lightdb.manager.SpringScheduledTask,定时任务添加成功 [192.168.76.128] [17333] [com.hundsun.lightdb.manager.service.impl.host.EmLogTask]
2023-01-30 15:38:03.322,main,INFO ,com.hundsun.lightdb.backman.service.config.BackUpScheduledConfig,定时任务注册器:org.springframework.scheduling.config.ScheduledTaskRegistrar@6addfa22
2023-01-30 15:38:03.322,main,INFO ,org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler,Initializing ExecutorService
2023-01-30 15:38:03.418,main,INFO ,org.quartz.core.QuartzScheduler,Scheduler QuartzScheduler_$_NON_CLUSTERED started.
2023-01-30 15:38:03.424,main,INFO ,org.apache.coyote.http11.Http11NioProtocol,Starting ProtocolHandler ["http-nio-17333"]
2023-01-30 15:38:03.426,main,INFO ,org.apache.tomcat.util.net.NioSelectorPool,Using a shared selector for servlet write/read
2023-01-30 15:38:03.480,main,INFO ,org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer,Tomcat started on port(s): 17333 (http)
2023-01-30 15:38:03.494,main,INFO ,com.hundsun.lightdb.EmStarter,Started EmStarter in 45.612 seconds (JVM running for 49.068)

手工调整em内嵌的绿色版本lightdb监控端口引发的问题

  1. em内嵌的绿色版本的lightdb的版本(13.8-22.4)已支持单机分布式,默认启动后监听端口为5434,查看该端口涉及的表


# em内嵌的绿色版本的lightdb默认监听端口5434
[lightdb@192_168_76_128 data]$ pwd
/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4/data
[lightdb@192_168_76_128 data]$ grep -w port lightdb.conf
port = 5434                             # (change requires restart)
                                        #   %r = remote host and port

# 绿色版本的lighdb该端口5434,该端口影响到数据库表如下:
# 1、数据库postgres表cron.job
# 2、数据库postgres表servers
# 3、数据库em表pg_dist_node
[lightdb@192_168_76_128 data]$ ltsql -p5434
ltsql (13.8-22.4)
Type "help" for help.

lightdb@postgres=# \x
Expanded display is on.
lightdb@postgres=# select * from cron.job;
-[ RECORD 1 ]-------------------------------
jobid    | 1
schedule | */5 * * * *
command  | SELECT lt_catalog.pg_show_plans()
nodename | localhost
nodeport | 5434
database | postgres
username | lightdb
active   | t
jobname  | lt_show_plans
-[ RECORD 2 ]-------------------------------
jobid    | 2
schedule | */1 * * * * *
command  | SELECT collect_activity_history()
nodename | localhost
nodeport | 5434
database | postgres
username | lightdb
active   | t
jobname  | collect_activity_history
-[ RECORD 3 ]-------------------------------
jobid    | 3
schedule | */1 * * * *
command  | SELECT collect_activity_profile()
nodename | localhost
nodeport | 5434
database | postgres
username | lightdb
active   | t
jobname  | collect_activity_profile
-[ RECORD 4 ]-------------------------------
jobid    | 4
schedule | 0 0 * * *
command  | SELECT clean_activity_profile()
nodename | localhost
nodeport | 5434
database | postgres
username | lightdb
active   | t
jobname  | clean_activity_profile
-[ RECORD 5 ]-------------------------------
jobid    | 5
schedule | */10 * * * *
command  | SELECT lt_catalog.take_sample()
nodename | localhost
nodeport | 5434
database | postgres
username | lightdb
active   | t
jobname  | take_sample

lightdb@postgres=# select * from servers;
-[ RECORD 1 ]------+------------------------------
server_id          | 1
server_name        | local
server_description |
server_created     | 2022-12-30 18:22:58.656249+08
db_exclude         |
enabled            | t
connstr            | dbname=postgres port=5434
max_sample_age     |
last_sample_id     | 1
size_smp_wnd_start |
size_smp_wnd_dur   |
size_smp_interval  |

lightdb@postgres=# \c em
You are now connected to database "em" as user "lightdb".
lightdb@em=# select * from pg_dist_node;
-[ RECORD 1 ]----+----------
nodeid           | 1
groupid          | 0
nodename         | localhost
nodeport         | 5434
noderack         | default
hasmetadata      | t
isactive         | t
noderole         | primary
nodecluster      | default
metadatasynced   | t
shouldhaveshards | t


  1. 手动修改em内嵌的绿色版本的lightdb监听端口(配置文件${LTDATA}/lightdb.conf中配置项port)为5436并一键重启em,在em安装主机代理后,代理日志报错。

# 一键停止em内嵌的绿色版本lightdb和em
[lightdb@192_168_76_128 scripts]$ ./stop_all.sh
/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/scripts
15:50:52 em_stop.sh green LTBASE: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em]
15:50:52 em_stop.sh green LTHOME: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4]
15:50:52 em_stop.sh green LTDATA: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4/data]
waiting for server to shut down.... done
server stopped

# 手动修改em内嵌的绿色版本的lightdb监听端口为5436
[lightdb@192_168_76_128 data]$ echo "port=5436" >> lightdb.conf

[lightdb@192_168_76_128 data]$ grep -w port lightdb.conf
port = 5434                             # (change requires restart)
                                        #   %r = remote host and port
port=5436

# 一键启动em内嵌的绿色版本lightdb和em
[lightdb@192_168_76_128 scripts]$ pwd
/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/scripts
[lightdb@192_168_76_128 scripts]$ ./start_all.sh
log path: /home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/redis/redis.log
15:53:00 em_start.sh kill old em process and green lightdb instance process first
15:53:00 em_stop.sh green LTBASE: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em]
15:53:00 em_stop.sh green LTHOME: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4]
15:53:00 em_stop.sh green LTDATA: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4/data]
15:53:00 em_stop.sh No green lightdb instance process !!!
 15:53:00 em_start.sh GREEN_LIGHTDB_VERSION : 13.8-22.4
15:53:00 em_start.sh LTHOME: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4]
15:53:00 em_start.sh LTDATA: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4/data]
15:53:00 em_start.sh checking green lightdb instance process whether started or not....
15:53:00 em_start.sh LTDATA :/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4/data] not occupy. now start green lightdb instance
waiting for server to start....2023-01-30 15:53:01.064502T,,,,,postmaster,,00000,2023-01-30 15:53:01 CST,0,62454,LOG:  requesting named LWLockTranch for canopy_query_stats
2023-01-30 15:53:01.070042T,,,,,postmaster,,00000,2023-01-30 15:53:01 CST,0,62454,LOG:  LightDB autoprewarm: prewarm dbnum=0
2023-01-30 15:53:01.076427T,,,,,postmaster,,00000,2023-01-30 15:53:01 CST,0,62454,INFO:  invoking IpcMemoryCreate(size=440696832)
2023-01-30 15:53:01.176758T,,,,,postmaster,,00000,2023-01-30 15:53:01 CST,0,62454,LOG:  redirecting log output to logging collector process
2023-01-30 15:53:01.176758T,,,,,postmaster,,00000,2023-01-30 15:53:01 CST,0,62454,HINT:  Future log output will appear in directory "log".
 done
server started
15:53:01 em_start.sh start green lightdb instance sucess and prepare start em process
15:53:01 em_start.sh now  start em process...
15:53:01 em_start.sh em log path: /home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/logs
/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/scripts
/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/scripts
log path: /home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/gotty/gotty.log


# 下面的数据库和表中端口依旧是5434
# 1、数据库postgres表cron.job
# 2、数据库postgres表servers
# 3、数据库em表pg_dist_node


[lightdb@192_168_76_128 scripts]$ ltsql -p 5436
ltsql (13.8-22.4)
Type "help" for help.

lightdb@postgres=# \x
Expanded display is on.
lightdb@postgres=# select * from servers;
-[ RECORD 1 ]------+------------------------------
server_id          | 1
server_name        | local
server_description |
server_created     | 2022-12-30 18:22:58.656249+08
db_exclude         |
enabled            | t
connstr            | dbname=postgres port=5434
max_sample_age     |
last_sample_id     | 2
size_smp_wnd_start |
size_smp_wnd_dur   |
size_smp_interval  |

lightdb@postgres=# select * from cron.job;
-[ RECORD 1 ]-------------------------------
jobid    | 1
schedule | */5 * * * *
command  | SELECT lt_catalog.pg_show_plans()
nodename | localhost
nodeport | 5434
database | postgres
username | lightdb
active   | t
jobname  | lt_show_plans
-[ RECORD 2 ]-------------------------------
jobid    | 2
schedule | */1 * * * * *
command  | SELECT collect_activity_history()
nodename | localhost
nodeport | 5434
database | postgres
username | lightdb
active   | t
jobname  | collect_activity_history
-[ RECORD 3 ]-------------------------------
jobid    | 3
schedule | */1 * * * *
command  | SELECT collect_activity_profile()
nodename | localhost
nodeport | 5434
database | postgres
username | lightdb
active   | t
jobname  | collect_activity_profile
-[ RECORD 4 ]-------------------------------
jobid    | 4
schedule | 0 0 * * *
command  | SELECT clean_activity_profile()
nodename | localhost
nodeport | 5434
database | postgres
username | lightdb
active   | t
jobname  | clean_activity_profile
-[ RECORD 5 ]-------------------------------
jobid    | 5
schedule | */10 * * * *
command  | SELECT lt_catalog.take_sample()
nodename | localhost
nodeport | 5434
database | postgres
username | lightdb
active   | t
jobname  | take_sample

lightdb@postgres=# \c em
You are now connected to database "em" as user "lightdb".
lightdb@em=# select * from pg_dist_node;
-[ RECORD 1 ]----+----------
nodeid           | 1
groupid          | 0
nodename         | localhost
nodeport         | 5434
noderack         | default
hasmetadata      | t
isactive         | t
noderole         | primary
nodecluster      | default
metadatasynced   | t
shouldhaveshards | t

lightdb@em=#

# 修改${em_install_path}/config/jrescloud.conf中绿色版本lightdb数据库连接信息中端口为5436,一键启动绿色版本lightdb和em
[lightdb@192_168_76_128 scripts]$ ./start_all.sh
log path: /home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/redis/redis.log
16:04:16 em_start.sh kill old em process and green lightdb instance process first
16:04:16 em_stop.sh green LTBASE: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em]
16:04:16 em_stop.sh green LTHOME: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4]
16:04:16 em_stop.sh green LTDATA: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4/data]
16:04:16 em_stop.sh No green lightdb instance process !!!
 16:04:16 em_start.sh GREEN_LIGHTDB_VERSION : 13.8-22.4
16:04:16 em_start.sh LTHOME: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4]
16:04:16 em_start.sh LTDATA: [/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4/data]
16:04:16 em_start.sh checking green lightdb instance process whether started or not....
16:04:16 em_start.sh LTDATA :/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/lightdb-x-for-em/13.8-22.4/data] not occupy. now start green lightdb instance
waiting for server to start....2023-01-30 16:04:16.330652T,,,,,postmaster,,00000,2023-01-30 16:04:16 CST,0,67085,LOG:  requesting named LWLockTranch for canopy_query_stats
2023-01-30 16:04:16.333035T,,,,,postmaster,,00000,2023-01-30 16:04:16 CST,0,67085,LOG:  LightDB autoprewarm: prewarm dbnum=0
2023-01-30 16:04:16.335601T,,,,,postmaster,,00000,2023-01-30 16:04:16 CST,0,67085,INFO:  invoking IpcMemoryCreate(size=440696832)
2023-01-30 16:04:16.452213T,,,,,postmaster,,00000,2023-01-30 16:04:16 CST,0,67085,LOG:  redirecting log output to logging collector process
2023-01-30 16:04:16.452213T,,,,,postmaster,,00000,2023-01-30 16:04:16 CST,0,67085,HINT:  Future log output will appear in directory "log".
 done
server started
16:04:16 em_start.sh start green lightdb instance sucess and prepare start em process
16:04:16 em_start.sh now  start em process...
16:04:16 em_start.sh em log path: /home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/logs
/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/scripts
/home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/scripts
log path: /home/lightdb/lightdb-em-13.8-22.4-932edbddb-el7.x86_64/em/gotty/gotty.log
 
  1. 通过em在线安装主机agent,主机agent日志报错内容如下,连接的em数据库所在绿色版本lightdb端口依旧是5434而不是手动修改后的5436:

org.postgresql.util.PSQLException: ERROR: connection to the remote node localhost:5434 failed with the following error: FATAL:  database "em" does not exist
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2552) ~[postgresql-42.2.23.jar!/:42.2.23]
    at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2284) ~[postgresql-42.2.23.jar!/:42.2.23]
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:322) ~[postgresql-42.2.23.jar!/:42.2.23]
    at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:481) ~[postgresql-42.2.23.jar!/:42.2.23]
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:401) ~[postgresql-42.2.23.jar!/:42.2.23]
    at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:164) ~[postgresql-42.2.23.jar!/:42.2.23]
    at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:153) ~[postgresql-42.2.23.jar!/:42.2.23]
    at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:497) ~[druid-1.1.24.jar!/:1.1.24]
    at org.apache.ibatis.executor.statement.PreparedStatementHandler.query(PreparedStatementHandler.java:63) ~[mybatis-3.4.6.jar!/:3.4.6]
    at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:79) ~[mybatis-3.4.6.jar!/:3.4.6]
    at org.apache.ibatis.executor.ReuseExecutor.doQuery(ReuseExecutor.java:60) ~[mybatis-3.4.6.jar!/:3.4.6]
    at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:326) ~[mybatis-3.4.6.jar!/:3.4.6]
    at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) ~[mybatis-3.4.6.jar!/:3.4.6]
    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) ~[mybatis-3.4.6.jar!/:3.4.6]
    at com.github.pagehelper.PageInterceptor.intercept(PageInterceptor.java:111) ~[pagehelper-5.2.0.jar!/:?]
    at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61) ~[mybatis-3.4.6.jar!/:3.4.6]
    at com.sun.proxy.$Proxy162.query(Unknown Source) ~[?:?]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) ~[mybatis-3.4.6.jar!/:3.4.6]
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) ~[mybatis-3.4.6.jar!/:3.4.6]
    at jdk.internal.reflect.GeneratedMethodAccessor210.invoke(Unknown Source) ~[?:?]
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
    at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:433) ~[mybatis-spring-1.3.2.jar!/:1.3.2]
    at com.sun.proxy.$Proxy100.selectList(Unknown Source) ~[?:?]
    at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:230) ~[mybatis-spring-1.3.2.jar!/:1.3.2]
    at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:139) ~[mybatis-3.4.6.jar!/:3.4.6]
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:76) ~[mybatis-3.4.6.jar!/:3.4.6]
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59) ~[mybatis-3.4.6.jar!/:3.4.6]

手工调整了em内嵌的绿色版本lightdb监控端口引发的问题解决

基本思路

  • 执行sql修改"数据库postgres表cron.job",“数据库postgres表servers”,“数据库em表pg_dist_node”端口内容为调整后的端口。

  • 修改${em_install_path}/config/jrescloud.properties文件中绿色版本lightdb监听端口为修改后的端口。

具体操作步骤

em内嵌的绿色版本数据库端口默认5434,手动修改后为5436

1、[lightdb@192_168_76_128 scripts]$ ltsql -h localhost -p5436 -d postgres -c 'update cron.job set nodeport=5436;'

UPDATE 5

2、[lightdb@192_168_76_128 scripts]$ ltsql -h localhost -p5436 -d postgres -c "update servers set connstr='dbname=postgres port=5436';"

UPDATE 1

3、[lightdb@192_168_76_128 scripts]$ ltsql -h localhost -p5436 -d em -c "update pg_dist_node set nodeport=5436;"

UPDATE 1

4、修改${em_install_path}/config/jrescloud.properties文件中绿色版本lightdb监听端口为修改后的端口。

dyn.spring.datasources[0].url=jdbc:postgresql://192.168.76.128:5436/em?ApplicationName=lightdbem&socketTimeout=5000&options=-c%20lock_timeout=30min

验证一下em内嵌的绿色版本数据库中相关表的端口字段是否已改为5436

[lightdb@192_168_76_128 logs]$  ltsql -h localhost -p5436 -d em -c "select nodeport from pg_dist_node"
 nodeport
----------
     5436
(1 row)

[lightdb@192_168_76_128 logs]$ ltsql -h localhost -p5436 -d postgres -c "select connstr from servers"
          connstr
---------------------------
 dbname=postgres port=5436
(1 row)


[lightdb@192_168_76_128 logs]$ ltsql -h localhost -p5436 -d postgres -c "select nodeport from cron.job"
 nodeport
----------
     5436
     5436
     5436
     5436
     5436
(5 rows)

查看此时的主机agent日志内容如下

2023-01-30 16:28:50.019 [agent-task-7] INFO  com.hundsun.lightdb.agent.task.timing.BaseTask - [内存使用率采集] success
2023-01-30 16:28:50.073 [agent-task-5] INFO  com.hundsun.lightdb.utils.ShellUtils - result:0
2023-01-30 16:28:50.073 [agent-task-5] INFO  com.hundsun.lightdb.utils.ShellUtils - command:/usr/local/lightdb/agent/host/agent/collect/disk_blk.sh
2023-01-30 16:28:50.079 [agent-task-5] INFO  com.hundsun.lightdb.utils.ShellUtils - result:0
2023-01-30 16:28:50.082 [agent-task-5] INFO  com.hundsun.lightdb.agent.task.timing.BaseTask - [文件系统采集] success
2023-01-30 16:28:51.007 [agent-task-3] INFO  com.hundsun.lightdb.agent.task.timing.BaseTask - [CPU使用率采集] success
2023-01-30 16:29:00.000 [agent-task-3] INFO  com.hundsun.lightdb.agent.task.timing.BaseTask - [CPU使用率采集] begin
2023-01-30 16:29:00.001 [agent-task-2] INFO  com.hundsun.lightdb.agent.task.timing.BaseTask - [文件系统采集] begin
2023-01-30 16:29:00.002 [agent-task-6] INFO  com.hundsun.lightdb.agent.task.timing.BaseTask - [内存使用率采集] begin
2023-01-30 16:29:00.002 [agent-task-7] INFO  com.hundsun.lightdb.agent.task.timing.BaseTask - [网络采集] begin
2023-01-30 16:29:00.005 [agent-task-2] INFO  com.hundsun.lightdb.utils.ShellUtils - command:/usr/local/lightdb/agent/host/agent/collect/disk.sh
2023-01-30 16:29:00.005 [agent-task-6] INFO  com.hundsun.lightdb.utils.ShellUtils - command:free -m
2023-01-30 16:29:00.006 [agent-task-7] INFO  com.hundsun.lightdb.utils.ShellUtils - command:cat /proc/net/dev
2023-01-30 16:29:00.010 [agent-task-7] INFO  com.hundsun.lightdb.utils.ShellUtils - result:0
2023-01-30 16:29:00.012 [agent-task-6] INFO  com.hundsun.lightdb.utils.ShellUtils - result:0
2023-01-30 16:29:00.015 [agent-task-6] INFO  com.hundsun.lightdb.agent.task.timing.BaseTask - [内存使用率采集] success
2023-01-30 16:29:00.022 [agent-task-7] INFO  com.hundsun.lightdb.agent.task.timing.BaseTask - [网络采集] success
2023-01-30 16:29:00.070 [agent-task-2] INFO  com.hundsun.lightdb.utils.ShellUtils - result:0
2023-01-30 16:29:00.070 [agent-task-2] INFO  com.hundsun.lightdb.utils.ShellUtils - command:/usr/local/lightdb/agent/host/agent/collect/disk_blk.sh
2023-01-30 16:29:00.075 [agent-task-2] INFO  com.hundsun.lightdb.utils.ShellUtils - result:0
2023-01-30 16:29:00.078 [agent-task-2] INFO  com.hundsun.lightdb.agent.task.timing.BaseTask - [文件系统采集] success
2023-01-30 16:29:01.009 [agent-task-3] INFO  com.hundsun.lightdb.agent.task.timing.BaseTask - [CPU使用率采集] success

也可以登录em页面(http://192.168.76.128:17333/em/workbench-tab.html 用户名/密码:system/hs123456)在主机管理下载主机agent日志

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值