microscope页面Transactions信息滞后

新接手cita项目,发现浏览器页面交易数据滞后90天,查看re-birth-db日志,报这个错,
因为之前不熟悉cita,在这里求助下各位大佬。

2020-05-12 07:35:49.646 UTC [35] ERROR:  duplicate key value violates unique constraint "blocks_pkey"
2020-05-12 07:35:49.646 UTC [35] DETAIL:  Key (block_hash)=(0x6bcb233d512a3d46bf9df43c2d6a984a79f5f2779fa08cbc6c1465c94d12d98a) already exists.

这个可能是同步服务没有启动,你如果是用 docker-compose 启动,可以执行 make ps 应该能看到有个 sync 服务,例如:

↪  make ps                                                                                                                                            Tue May 12 14:17:35 CST 2020
docker-compose ps
        Name                       Command               State          Ports
-------------------------------------------------------------------------------------
re-birth_app_1       bundle exec puma -C config ...   Up      3000/tcp
re-birth_db_1        docker-entrypoint.sh postgres    Up      5432/tcp
re-birth_redis_1     docker-entrypoint.sh redis ...   Up      6379/tcp
re-birth_sidekiq_1   bundle exec sidekiq -C con ...   Up      3000/tcp
re-birth_sync_1      bash -c rails daemons:sync ...   Up      3000/tcp
re-birth_web_1       nginx -g daemon off;             Up      0.0.0.0:8888->80/tcp

如果没有则需要启动起来,例如使用 make up


re-birth_sidekiq这个容器启动之后马上就退出了
re-birth-db 日志报这个

2020-05-12 08:37:25.593 UTC [1027] FATAL:  sorry, too many clients already
2020-05-12 08:37:25.653 UTC [1028] FATAL:  sorry, too many clients already
2020-05-12 08:37:28.064 UTC [1029] FATAL:  sorry, too many clients already
2020-05-12 08:37:33.452 UTC [1030] FATAL:  sorry, too many clients already

其他容器日志正常

pg显示太多链接数?
尝试重启下所有服务吧,例如用make down,然后用make up

这次重启完成后容器状态都是正常的
但是进app容器看同步状态有问题

# rails daemons:sync:status
production_sync: no instances running
pid-file for killed process 39 found (/app/tmp/pids/production_sync.pid), deleting.

过了一会 db容器日志还是报这个错

2020-05-12 09:12:30.941 UTC [72] STATEMENT:  INSERT INTO "blocks" ("block_hash", "version", "header", "block_number", "created_at", "updated_at", "transaction_count", "proposer", "quota_used") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "block_hash"
2020-05-12 09:12:30.976 UTC [50] ERROR:  duplicate key value violates unique constraint "blocks_pkey"
2020-05-12 09:12:30.976 UTC [50] DETAIL:  Key (block_hash)=(0xb61766b358f6ad13cbcc2eee3dbb42231fe6458e3a7170cd280b0c96caeb4b8c) already exists.

进app容器看同步状态有问题

你可能进入错容器了,要进入 sync 服务所在的容器,使用这个命令: docker-compose exec sync rake daemons:sync:status

看了下是running的

production_sync: running [pid 65]

但是页面上交易信息还是没同步过来,没有变化

可以提供信息太少无法判断是什么原因。
现在是试用阶段吗?可以把rebirth的数据库drop 掉,重新开始同步。

好的,我重新部署一套试试看。

现在同步正常了,再请教个问题,logs下面的文件(比如cita-network.log)现在很大,这种日志可以清理吗,对链有没有影响。

可以清除的,建议在生产环境中定时做日志切割,保留最近一个月的,这样有故障时可以排查

好的,谢谢。