2012-09-05 47 views
28

我在Windows 7上安裝了構建代理,並始終讓代理顯示爲「斷開連接」。日誌teamcity-agent.txt顯示以下信息TeamCity構建代理已斷開連接

If this is the first time this agent registered on the server make sure it is  authorized by administrator in the server web UI. 
[2012-09-05 02:56:14,416] INFO - jetbrains.buildServer.AGENT - Agent registration finished. 
[2012-09-05 02:56:14,418] INFO - jetbrains.buildServer.AGENT - Stop command was not performed. No build to stop with reason: BuildInterruptReason.AGENT_SHUTDOWN 
[2012-09-05 02:56:14,418] INFO - jetbrains.buildServer.AGENT - Starting agent shutdown sequence, reason: Restart agent, failed to download upgrade from server 
[2012-09-05 02:56:14,424] INFO - jetbrains.buildServer.AGENT - Host configuration for downloading updates: HostConfiguration[host=http://myteamcity:8080] 
[2012-09-05 02:56:14,424] INFO - jetbrains.buildServer.AGENT - Downloading http://myteamcity:8080/update/teamcity-agent.xml ==> C:\BuildAgent\temp\iQ0fjie6zR125neulJeqiYauT8zQ5zOI 
[2012-09-05 02:56:15,070] INFO - jetbrains.buildServer.AGENT - Downloading http://myteamcity:8080/update/plugins/agentSystemInfo.zip ==> C:\BuildAgent\update\plugins\agentSystemInfo.zip 
[2012-09-05 02:56:15,747] INFO - jetbrains.buildServer.AGENT - Downloading http://myteamcity:8080/update/plugins/amazonEC2.zip ==> C:\BuildAgent\update\plugins\amazonEC2.zip 
[2012-09-05 02:56:16,617] INFO - agent.impl.AgentPortFileWriter - Delete agent runtime file from C:\BuildAgent\logs\buildAgent.port 
[2012-09-05 02:56:16,619] INFO - jetbrains.buildServer.AGENT - Unregistering from build server: 18 
[2012-09-05 02:56:16,800] INFO - jetbrains.buildServer.AGENT - Shutdown agent WebServer start 
[2012-09-05 02:56:16,801] INFO - jetbrains.buildServer.AGENT - Shutdown agent WebServer finish 
[2012-09-05 02:56:16,801] INFO - jetbrains.buildServer.AGENT - Shutdown agent finish 
[2012-09-05 02:56:16,968] INFO - jetbrains.buildServer.AGENT - Downloading http://myteamcity:8080/update/plugins/ant.zip ==> C:\BuildAgent\update\plugins\ant.zip 
[2012-09-05 02:56:50,086] INFO - jetbrains.buildServer.AGENT - Downloading http://myteamcity:8080/update/plugins/antPlugin.zip ==> C:\BuildAgent\update\plugins\antPlugin.zip 
[2012-09-05 02:56:52,070] INFO - jetbrains.buildServer.AGENT - Downloading http://myteamcity:8080/update/plugins/assembly-info-patcher.zip ==> C:\BuildAgent\update\plugins\assembly-info-patcher.zip 
[2012-09-05 02:56:53,464] INFO - jetbrains.buildServer.AGENT - Downloading http://myteamcity:8080/update/plugins/clearcase-agent.zip ==> C:\BuildAgent\update\plugins\clearcase-agent.zip 
[2012-09-05 02:56:55,375] INFO - jetbrains.buildServer.AGENT - Downloading http://myteamcity:8080/update/plugins/cmake-runner.zip ==> C:\BuildAgent\update\plugins\cmake-runner.zip 
[2012-09-05 02:56:57,190] INFO - jetbrains.buildServer.AGENT - Downloading http://myteamcity:8080/update/plugins/commandLineRunner.jar ==> C:\BuildAgent\update\plugins\commandLineRunner.jar 
[2012-09-05 02:56:58,218] INFO - jetbrains.buildServer.AGENT - Downloading http://myteamcity:8080/update/plugins/coveragePlugin.zip ==> C:\BuildAgent\update\plugins\coveragePlugin.zip 
[2012-09-05 02:57:11,629] INFO - jetbrains.buildServer.AGENT - Downloading http://myteamcity:8080/update/plugins/crashDetector.zip ==> C:\BuildAgent\update\plugins\crashDetector.zip 
[2012-09-05 02:57:12,436] INFO - jetbrains.buildServer.AGENT - Downloading http://myteamcity:8080/update/plugins/cvsAgent.zip ==> C:\BuildAgent\update\plugins\cvsAgent.zip 
[2012-09-05 02:57:20,720] INFO - jetbrains.buildServer.AGENT - Downloading http://myteamcity:8080/update/plugins/dotCover.zip ==> C:\BuildAgent\update\plugins\dotCover.zip 
[2012-09-05 02:58:00,011] INFO - jetbrains.buildServer.AGENT - Downloading http://myteamcity:8080/update/plugins/dotNetPlugin.zip ==> C:\BuildAgent\update\plugins\dotNetPlugin.zip 

如何獲取代理連接?

+4

這是正常的。當您安裝代理(存根)時,它會使用最新的軟件包自行更新。你只需等待。 –

回答

9

首先,確保在TeamCity網站的儀表板上授權代理如果您還沒有這樣做。

接下來,請確保代理「ownPort」未被代理上的防火牆阻止。這是TeamCity將用於向代理髮送消息的端口。該值可以在「$ {agent.home} /conf/buildAgent.properties」中定義。

從TeamCity 2017.2.1開始,「ownPort」不存在,也沒有任何嵌入式文檔(即註釋示例)。默認值是8080,但你可以只添加屬性,你想這樣的價值:

## Defines which port the agent will use to receive messages from TeamCity. 
## Defaults to 8080 if not present. 
ownPort=9091 
+3

我發現代理今天早上已連接。看起來任何新的團隊代理都需要時間來刷新自己。我們只需要等待它完成。我的確發現了其他論壇報道的類似情況。 –

31

這裏是關於重新連接斷開的代理商非常全面的博客

http://michaelbarnesjr.wordpress.com/2012/10/18/teamcity-build-agent-disconnected/

這裏有步驟(從上面的鏈接複製)

如果代理變爲無論出於何種原因斷開連接,你可以按照以下步驟重新連接它:

  • ssh到斷開連接的代理程序所在的服務器。
  • 去生成代理的bin目錄(例如/選擇/的TeamCity/buildagent/buildagent01 /斌/)
  • su到該代理程序作爲(即的AppBuilder)
  • 運行用戶agent.sh開始

這將啓動代理,幾秒鐘後,當您下一次進入TeamCity時,它將被連接。

如果Team City運行在Windows服務器上,則可以連接到該服務器,轉到服務並重新啓動已斷開連接的構建代理。 Team City

+0

你可以按照Windows博客上的步驟嗎?我正在嘗試做,但不知道從哪裏開始。請檢查此問題https://stackoverflow.com/questions/46336098/how-to-ssh-to-a-server-in-windows-7 – user32882

2

在Windows下的8個專業我的情況:

TC生成代理升級失敗

  1. 我檢查了BuildAgent\logs\teamcity-agent.log,有一個與 「升級過程」 的麻煩。

  2. 我檢出了BuildAgent\logs\upgrade.log,還有更詳細的「DEBUG」消息。問題在於關閉服務時「拒絕訪問」。

  3. 我將TC服務器服務的用戶帳戶添加到「管理員」,讓它停止代理服務。

  4. 我從「管理員」用戶組中刪除了TC服務器服務的用戶帳戶。

  5. 重新啓動這兩個服務(TC服務器+代理)領導終於有:

    BuildAgent\logs\buildAgent.port 
    

    文件:代理全成之後終於連接。

+0

將運行該服務的帳戶添加到本地管理員做了訣竅,謝謝! –

9

在我的情況下,代理已啓動,但被列爲斷開連接,等待幾分鐘後仍然斷開。所以我去了像Peter建議的構建代理的bin目錄,並運行以下兩個命令:

./agent.sh stop 
./agent.sh start 

基本上只是重新啓動構建代理。這對我來說是訣竅。

0

在服務面板中手動啓動TeamCity代理爲我解決了問題(在Windows計算機上)。

問題表明在upgrade.log中(在BuildAgent \ logs目錄):

ERROR - r.agent.upgrade.UpgradeRunBase - Failed to start agent after upgrade: java.io.IOException: Failed to start TeamCity build agent service. Please check TeamCity build agent service user have enough permissions to stop and start the service. 
1

我曾與服務器問題和更改端口服務器。

因此,該代理無法連接到服務器,因爲我只更改了服務器端口而不是代理屬性。

一旦我更新了代理屬性,代理又開始工作了。

的性質下找到: 的TeamCity \ buildAgent \ CONF \ buildAgent.properties

該場所被發現,如: 的serverUrl = HTTP://本地主機:8080

0

我碰到這個問題時通過VPN遠程工作,我的IP地址改變了。在conf/buildAgent.properties文件中,我更改了我爲serverURL屬性分配的IP,以使用localhost,代理連接正確。

## The address of the TeamCity server. The same as is used to open 
TeamCity web interface in the browser. 
#serverUrl=http://111.222.333.444:8111 
serverUrl=http://localhost:8111 
+0

在我的情況下,我更新服務器的URL,因爲服務器的端口改變,並工作! – Joseph