按照西蒙的建议,我已经能够解决我的问题。
我有
- 从 3.2.1 升级到 5.1.2 之前从数据库中恢复了备份
- 升级到 4.5.6 LTS 版本
- 在 4.5.6 版本上运行几天的一些分析,确保一切都按预期工作
- 为 4.5.6 版本创建了数据库的备份
- 执行升级到版本 5.1.2
在迁移到 5.1.2 的过程中,IndexSynchronizer 遇到了一些麻烦(由于 elasticsearch 显然使主机的 CPU 过载):
2015.11.03 13:21:23 INFO web[o.s.s.s.IndexSynchronizer] Index source lines
2015.11.03 13:22:10 INFO es[o.e.monitor.jvm] [sonar-1446552525578] [gc][young][766][38] duration [784ms], collections [1]/[1s], total [784ms]/[6.6s], memory [194mb]->[126.7mb]/[989.8mb], all_pools {[young] [58.6mb]->[2.1kb]/[273mb]}{[survivor] [8.5mb]->[8.5mb]/[34.1mb]}{[old] [126.8mb]->[118.2mb]/[682.6mb]}
2015.11.03 13:22:23 INFO web[o.s.s.es.BulkIndexer] 110525 requests processed (1842 items/sec)
2015.11.03 13:22:30 WARN es[o.e.monitor.jvm] [sonar-1446552525578] [gc][young][784][51] duration [2.1s], collections [2]/[2.9s], total [2.1s]/[10.7s], memory [175.6mb]->[148.3mb]/[989.8mb], all_pools {[young] [42.2mb]->[37.3kb]/[273mb]}{[survivor] [8.5mb]->[8.5mb]/[34.1mb]}{[old] [124.9mb]->[139.7mb]/[682.6mb]}
2015.11.03 13:23:23 INFO web[o.s.s.es.BulkIndexer] 126712 requests processed (269 items/sec)
2015.11.03 13:24:23 INFO web[o.s.s.es.BulkIndexer] 126712 requests processed (0 items/sec)
2015.11.03 13:25:23 INFO web[o.s.s.es.BulkIndexer] 126712 requests processed (0 items/sec)
2015.11.03 13:26:23 INFO web[o.s.s.es.BulkIndexer] 126712 requests processed (0 items/sec)
2015.11.03 13:27:24 INFO web[o.s.s.es.BulkIndexer] 126712 requests processed (0 items/sec)
2015.11.03 13:28:24 INFO web[o.s.s.es.BulkIndexer] 126712 requests processed (0 items/sec)
2015.11.03 13:29:24 INFO web[o.s.s.es.BulkIndexer] 126712 requests processed (0 items/sec)
2015.11.03 13:30:24 INFO web[o.s.s.es.BulkIndexer] 126712 requests processed (0 items/sec)
2015.11.03 13:31:24 INFO web[o.s.s.es.BulkIndexer] 126712 requests processed (0 items/sec)
2015.11.03 13:32:24 INFO web[o.s.s.es.BulkIndexer] 126712 requests processed (0 items/sec)
2015.11.03 13:33:24 INFO web[o.s.s.es.BulkIndexer] 126712 requests processed (0 items/sec)
2015.11.03 13:34:24 INFO web[o.s.s.es.BulkIndexer] 126712 requests processed (0 items/sec)
2015.11.03 13:35:24 INFO web[o.s.s.es.BulkIndexer] 126712 requests processed (0 items/sec)
2015.11.03 13:36:24 INFO web[o.s.s.es.BulkIndexer] 126712 requests processed (0 items/sec)
2015.11.03 13:37:24 INFO web[o.s.s.es.BulkIndexer] 126712 requests processed (0 items/sec)
2015.11.03 13:38:24 INFO web[o.s.s.es.BulkIndexer] 126712 requests processed (0 items/sec)
2015.11.03 13:39:24 INFO web[o.s.s.es.BulkIndexer] 126712 requests processed (0 items/sec)
2015.11.03 13:40:07 INFO web[o.e.client.transport] [sonar-1446552525578] failed to get node info for [#transport#-1][localhost][inet[/127.0.0.1:9001]], disconnecting...
org.elasticsearch.transport.ReceiveTimeoutTransportException: [][inet[/127.0.0.1:9001]][cluster:monitor/nodes/info] request_id [3417] timed out after [5834ms]
at org.elasticsearch.transport.TransportService$TimeoutHandler.run(TransportService.java:366) ~[elasticsearch-1.4.4.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_45]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
2015.11.03 13:40:07 WARN es[o.e.monitor.jvm] [sonar-1446552525578] [gc][young][788][54] duration [17.5m], collections [1]/[17.5m], total [17.5m]/[17.7m], memory [101mb]->[104.3mb]/[989.8mb], all_pools {[young] [7.8mb]->[380.8kb]/[273mb]}{[survivor] [8.5mb]->[8.5mb]/[34.1mb]}{[old] [84.7mb]->[95.5mb]/[682.6mb]}
Wrapper Process has not received any CPU time for 978 seconds. Extending timeouts.
2015.11.03 13:40:07 ERROR web[o.s.s.ui.JRubyFacade] Fail to upgrade database
java.util.concurrent.ExecutionException: java.lang.IllegalStateException: Fail to execute ES search request '{"size":100,"query":{"filtered":{"query":{"match_all":{}},"filter":{"bool":{"must":[{"term":{"fileUuid":"3d674506-5a64-4b1e-a849-2c051e736e55","_cache":false}},{"range":{"line":{"from":250,"to":null,"include_lower":false,"include_upper":true},"_cache":false}}],"_cache":false}}}},"_source":false}' on indices '[sourcelines]' on types '[sourceline]'
com.google.common.base.Throwables.propagate(Throwables.java:156)
org.sonar.server.es.BaseIndexer.index(BaseIndexer.java:77)
org.sonar.server.search.IndexSynchronizer.execute(IndexSynchronizer.java:90)
之后,它只是挂起,不会继续升级,也不会显示索引页面(/ 重定向到 /maintenance 和 /setup 都显示错误消息)。在停止并重新启动声纳后,它最终完成了源文件索引的迁移,并且从那里开始它似乎按预期工作。