CREATE USER 'gerrit2'@'localhost' IDENTIFIED BY 'secret'; #这个是创建个mysql的账号 CREATE DATABASE reviewdb; GRANT ALL ON reviewdb.* TO 'gerrit2'@'localhost'; #创建数据库,名字叫reviewdb FLUSH PRIVILEGES; #记得最后刷新,这样才生效。
[2017-08-15 08:53:20,516] [HTTP-75] ERROR com.google.gerrit.server.auth.ldap.LdapRealm : Cannot query LDAP to authenticate user javax.naming.CommunicationException: 10.0.64.234:389 [Root exception is java.net.ConnectException: 连接超时 (Connection timed out)] at com.sun.jndi.ldap.Connection.<init>(Connection.java:226) at com.sun.jndi.ldap.LdapClient.<init>(LdapClient.java:137) at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1615) at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2749) at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:319) at com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:192) at com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:210) at com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:153) at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:83) at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:684) at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:313) at javax.naming.InitialContext.init(InitialContext.java:244) at javax.naming.InitialContext.<init>(InitialContext.java:216) at javax.naming.directory.InitialDirContext.<init>(InitialDirContext.java:101) at com.google.gerrit.server.auth.ldap.Helper.open(Helper.java:135) at com.google.gerrit.server.auth.ldap.LdapRealm.authenticate(LdapRealm.java:234) at com.google.gerrit.server.account.AccountManager.authenticate(AccountManager.java:111) at com.google.gerrit.httpd.auth.ldap.LdapLoginServlet.doPost(LdapLoginServlet.java:122) at javax.servlet.http.HttpServlet.service(HttpServlet.java:648) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:286) at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:276) at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:181) at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:85) at com.google.gerrit.httpd.raw.StaticModule$PolyGerritFilter.doFilter(StaticModule.java:483) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) at com.google.gerrit.httpd.GetUserFilter.doFilter(GetUserFilter.java:75) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) at com.google.gerrit.httpd.UniversalWebLoginFilter.doFilter(UniversalWebLoginFilter.java:74) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) at com.google.gerrit.httpd.RunAsFilter.doFilter(RunAsFilter.java:111) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) at com.google.gwtexpui.server.CacheControlFilter.doFilter(CacheControlFilter.java:70) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) at com.google.gerrit.httpd.RequestMetricsFilter.doFilter(RequestMetricsFilter.java:57) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) at com.google.gerrit.httpd.AllRequestFilter$FilterProxy$1.doFilter(AllRequestFilter.java:133) at com.google.gerrit.httpd.AllRequestFilter$FilterProxy.doFilter(AllRequestFilter.java:135) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) at com.google.gerrit.httpd.RequestContextFilter.doFilter(RequestContextFilter.java:72) at com.google.inject.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.java:82) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:120) at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:135) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:224) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:56) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) at org.eclipse.jetty.server.Server.handle(Server.java:534) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108) at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) at java.lang.Thread.run(Thread.java:748) Caused by: java.net.ConnectException: 连接超时 (Connection timed out) at java.net.PlainSocketImpl.socketConnect(Native Method) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at java.net.Socket.connect(Socket.java:538) at java.net.Socket.<init>(Socket.java:434) at java.net.Socket.<init>(Socket.java:211) at com.sun.jndi.ldap.Connection.createSocket(Connection.java:363) at com.sun.jndi.ldap.Connection.<init>(Connection.java:203) ... 65 more
[2017-12-26 10:25:49,111] [main] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon com.google.inject.ProvisionException: Unable to provision, see the following errors:
1) No index versions for index 'accounts' ready; run java -jar /home/gerrit2/review_site/bin/gerrit.war reindex --index accounts
1 error at com.google.gerrit.server.index.VersionManager.initIndex(VersionManager.java:161) at com.google.gerrit.server.index.VersionManager.start(VersionManager.java:92) at com.google.gerrit.lifecycle.LifecycleManager.start(LifecycleManager.java:92) at com.google.gerrit.pgm.Daemon.start(Daemon.java:349) at com.google.gerrit.pgm.Daemon.run(Daemon.java:256) at com.google.gerrit.pgm.util.AbstractProgram.main(AbstractProgram.java:61) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.gerrit.launcher.GerritLauncher.invokeProgram(GerritLauncher.java:203) at com.google.gerrit.launcher.GerritLauncher.mainImpl(GerritLauncher.java:108) at com.google.gerrit.launcher.GerritLauncher.main(GerritLauncher.java:63) at Main.main(Main.java:24)
<VirtualHost *:80> ServerAdmin webmaster@localhost ServerName ci.company.com ServerAlias ci ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> #添加下面的3行,具体配置啥意思,可以查看手册,一般这样配置是不会有问题的。 ProxyPreserveHost on ProxyPass / http://your.gerrit.url.com:8080/ nocanon AllowEncodedSlashes NoDecode
Installing plugins. Install plugin singleusergroup version v2.12 [y/N]? y Install plugin commit-message-length-validator version v2.12 [y/N]? y Install plugin reviewnotes version v2.12 [y/N]? y Install plugin replication version v2.12 [y/N]? y Install plugin download-commands version v2.12 [y/N]? y Initializing plugins. No plugins found with init steps.
Upgrading schema to 108 ... Upgrading schema to 109 ... Upgrading schema to 110 ... Upgrading schema to 111 ... Upgrading schema to 112 ... Upgrading schema to 113 ... Upgrading schema to 114 ... Upgrading schema to 115 ... Migrating data to schema 108 ... Listing all changes ... Detected open changes referring to the following non-existent projects:
It is highly recommended to remove the obsolete open changes, comments and patch-sets from your DB.
done Updating groups for open changes ... done Migrating data to schema 109 ... Migrating data to schema 110 ... Migrating data to schema 111 ... Migrating data to schema 112 ... Migrating data to schema 113 ... Migrating data to schema 114 ... Migrating data to schema 115 ... Execute the following SQL to drop unused objects:
DROP TABLE account_diff_preferences; DROP TABLE patch_set_ancestors; ALTER TABLE accounts DROP COLUMN contact_filed_on;
Execute now [Y/n]? Y Initialized /home/gerrit2/review_site
gerrit2@gerrit-master:~/review_site$ bin/gerrit.sh start Starting Gerrit Code Review: OK
Initializing plugins. No plugins found with init steps.
Upgrading schema to 108 ... Upgrading schema to 109 ... Upgrading schema to 110 ... Upgrading schema to 111 ... Upgrading schema to 112 ... Upgrading schema to 113 ... Upgrading schema to 114 ... Upgrading schema to 115 ... Migrating data to schema 108 ... Listing all changes ... Detected open changes referring to the following non-existent projects:
It is highly recommended to remove the obsolete open changes, comments and patch-sets from your DB.
done Updating groups for open changes ... done Migrating data to schema 109 ... Migrating data to schema 110 ... Migrating data to schema 111 ... Migrating data to schema 112 ... Migrating data to schema 113 ... Migrating data to schema 114 ... Migrating data to schema 115 ... Execute the following SQL to drop unused objects:
DROP TABLE account_diff_preferences; DROP TABLE patch_set_ancestors; ALTER TABLE accounts DROP COLUMN contact_filed_on;
Execute now [Y/n]? Y Initialized /home/gerrit2/review_site
Upgrading schema to 120 ... Upgrading schema to 121 ... Upgrading schema to 122 ... Upgrading schema to 123 ... Upgrading schema to 124 ... Upgrading schema to 125 ... Upgrading schema to 126 ... Upgrading schema to 128 ... Upgrading schema to 129 ... Migrating data to schema 120 ... Generating Superproject subscriptions table to submodule ACLs Migrating data to schema 121 ... Migrating data to schema 122 ... Migrating data to schema 123 ... Updating references: 100% (520/520) Migrating data to schema 124 ... Migrating data to schema 125 ... Migrating data to schema 126 ... Migrating data to schema 128 ... Migrating data to schema 129 ... Execute the following SQL to drop unused objects:
DROP TABLE account_patch_reviews; DROP TABLE account_diff_preferences; DROP TABLE account_ssh_keys; DROP TABLE patch_set_ancestors; DROP TABLE starred_changes; DROP TABLE submodule_subscriptions; ALTER TABLE accounts DROP COLUMN contact_filed_on; ALTER TABLE accounts DROP COLUMN show_site_header; ALTER TABLE accounts DROP COLUMN time_format; ALTER TABLE accounts DROP COLUMN maximum_page_size; ALTER TABLE accounts DROP COLUMN use_flash_clipboard; ALTER TABLE accounts DROP COLUMN diff_view; ALTER TABLE accounts DROP COLUMN copy_self_on_email; ALTER TABLE accounts DROP COLUMN download_command; ALTER TABLE accounts DROP COLUMN download_url; ALTER TABLE accounts DROP COLUMN date_format; ALTER TABLE accounts DROP COLUMN legacycid_in_change_table; ALTER TABLE accounts DROP COLUMN review_category_strategy; ALTER TABLE accounts DROP COLUMN relative_date_in_change_table; ALTER TABLE accounts DROP COLUMN size_bar_in_change_table; ALTER TABLE accounts DROP COLUMN mute_common_path_prefixes;
Execute now [Y/n]? Y Initialized /home/gerrit2/review_site
这个是在我本地测试环境升级的,采用的是sudo apt update && sudo apt install gerrit 的方式升级的,这个升级之后发现一个报错 [2018-07-19 10:44:53,268] [HTTP-77] ERROR com.google.gerrit.pgm.http.jetty.HiddenErrorHandler : Error in GET /changes/git%2Fshared%2Ftools%2Faais-java~142/detail?O=116414 java.lang.NoSuchMethodError: com.google.gerrit.server.change.RevisionResource.getControl()Lcom/google/gerrit/server/project/ChangeControl; at com.googlesource.gerrit.plugins.wip.WorkInProgress.getDescription(WorkInProgress.java:71) at com.googlesource.gerrit.plugins.wip.WorkInProgress.getDescription(WorkInProgress.java:36) at com.google.gerrit.server.extensions.webui.UiActions.describe(UiActions.java:116) at com.google.gerrit.server.extensions.webui.UiActions.lambda$from$0(UiActions.java:74) at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193) at java.util.Iterator.forEachRemaining(Iterator.java:116) at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801) at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) at com.google.gerrit.server.extensions.webui.UiActions.from(UiActions.java:76) at com.google.gerrit.server.extensions.webui.UiActions.from(UiActions.java:67) at com.google.gerrit.server.change.ActionJson.toActionMap(ActionJson.java:213) at com.google.gerrit.server.change.ActionJson.addRevisionActions(ActionJson.java:110) at com.google.gerrit.server.change.ChangeJson.toRevisionInfo(ChangeJson.java:1348) at com.google.gerrit.server.change.ChangeJson.revisions(ChangeJson.java:1247) at com.google.gerrit.server.change.ChangeJson.toChangeInfo(ChangeJson.java:604) at com.google.gerrit.server.change.ChangeJson.format(ChangeJson.java:339) at com.google.gerrit.server.change.ChangeJson.format(ChangeJson.java:330) at com.google.gerrit.server.change.ChangeJson.format(ChangeJson.java:309) at com.google.gerrit.server.change.GetChange.apply(GetChange.java:47) at com.google.gerrit.server.change.GetDetail.apply(GetDetail.java:50) at com.google.gerrit.server.change.GetDetail.apply(GetDetail.java:25) at com.google.gerrit.httpd.restapi.RestApiServlet.service(RestApiServlet.java:397) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at com.google.inject.servlet.ServletDefinition.doServiceImpl(ServletDefinition.java:286) at com.google.inject.servlet.ServletDefinition.doService(ServletDefinition.java:276) at com.google.inject.servlet.ServletDefinition.service(ServletDefinition.java:181) at com.google.inject.servlet.ManagedServletPipeline.service(ManagedServletPipeline.java:91) at com.google.gerrit.httpd.raw.StaticModule$PolyGerritFilter.doFilter(StaticModule.java:483) at com.google.gerrit.httpd.GetUserFilter.doFilter(GetUserFilter.java:100) at com.google.gerrit.httpd.RunAsFilter.doFilter(RunAsFilter.java:122) at com.google.gwtexpui.server.CacheControlFilter.doFilter(CacheControlFilter.java:69) at com.google.gerrit.httpd.RequestMetricsFilter.doFilter(RequestMetricsFilter.java:57) at com.google.gerrit.httpd.AllRequestFilter$FilterProxy$1.doFilter(AllRequestFilter.java:133) at com.google.gerrit.httpd.AllRequestFilter$FilterProxy.doFilter(AllRequestFilter.java:135) at com.google.gerrit.httpd.RequestContextFilter.doFilter(RequestContextFilter.java:69) at com.google.inject.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.java:120) at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:135) at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:224) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:56) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) at org.eclipse.jetty.server.Server.handle(Server.java:534) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:108) at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) at java.lang.Thread.run(Thread.java:748) 通过排查,发现是某个插件没有升级到对应的2.15版本导致的。