0

Web Plaform Installer を使用して PHP をインストールする Web ロールを作成し (問題なく動作します)、Eclipse を使用して Worker ロールを作成し、MySql をインストールします。Eclipse は Mysql_WorkerRole.dll (とりわけ) を作成します。以下は私の.csdefファイルです

<WebRole enableNativeCodeExecution="true" name="PhpMySqlWA_phpWebRole">
<Startup>
  <Task commandLine="install-php.cmd" executionContext="elevated" taskType="background" />
</Startup>
<Sites>
  <Site name="MyPHPSite" physicalDirectory=".\PhpMySqlWA_phpWebRole">
    <Bindings>
      <Binding name="HttpEndpoint" endpointName="HttpIn" />
    </Bindings>
  </Site>
</Sites>
<Imports/>
<Endpoints>
  <InputEndpoint name="HttpIn" port="80" protocol="http"/>
</Endpoints>
<ConfigurationSettings>
  <Setting name="StorageAccountName"/>
  <Setting name="StorageAccountKey"/>
  <Setting name="SqlAzureHost"/>
  <Setting name="SqlAzureUserName"/>
  <Setting name="SqlAzurePassword"/>
  <Setting name="SqlAzureDatabase"/>
  <Setting name="UseDataStorage"/>
  <Setting name="UseDevelopmentStorage"/>
  <Setting name="UseCloudStorage"/>
  <Setting name="UseSqlAzure"/>
  <Setting name="LogLevel"/>
  <Setting name="ScheduledTransferPeriodInSeconds"/>
  <Setting name="WindowsAzureStorageConnectionString"/>
  <Setting name="XDrives"/>
  <Setting name="XDrivesLocalCache"/>
</ConfigurationSettings>
</WebRole>
<WorkerRole enableNativeCodeExecution="true" name="PhpMySqlWA_MysqlWorkerRole" vmsize="Medium">
<Imports>
  <Import moduleName="RemoteAccess" />
  <Import moduleName="RemoteForwarder" />
</Imports>
<LocalResources>
  <LocalStorage cleanOnRoleRecycle="false" name="MySQL" sizeInMB="260"/>
  <LocalStorage cleanOnRoleRecycle="false" name="MySQLDatastore" sizeInMB="60"/>
</LocalResources>
<ConfigurationSettings>
  <Setting name="InitFile"/>
  <Setting name="LogLevel"/>
  <Setting name="ScheduledTransferPeriodInSeconds"/>
  <Setting name="WindowsAzureStorageConnectionString"/>
</ConfigurationSettings>
 <Endpoints>
   <InternalEndpoint name="MySQL" protocol="tcp"/>
 </Endpoints>
</WorkerRole>

私が実行するとき

cspack ServiceDefinition.csdef /generateConfigurationFile:ServiceConfiguration.cscfg /role:PhpMySqlWA_MysqlWorkerRole;PhpMySqlWA_MysqlWorkerRole;Mysql_WorkerRole.dll /role:PhpMySqlWA_phpWebRole;PhpMySqlWA_phpWebRole /copyonly
and
csrun ServiceDefinition.csx ServiceConfiguration.cscfg /launchbrowser

Web ロールとワーカー ロールの両方が Compute Emulator で緑色になっています。ワーカー ロールについては次のように表示されます。

[fabric] Role Instance: deployment17(63).PhpMySqlWA.PhpMySqlWA_MysqlWorkerRole.0
[fabric] Role state Started
[runtime] Role entrypoint . CALLING   OnStart()
[WaWorkerHost.exe] RoleEntryPoint.OnStart()
[runtime] Role entrypoint . COMPLETED OnStart()
[runtime] Role entrypoint . CALLING   Run()
Information: Mysql_WorkerRole entry point called
Information: Copying folder mysql to C:/Users/ksaleh.CORP/AppData/Local/dftmp/Resources/d3fdb9aa-    67b5-4dad-9c50-0d5116ded0bc/directory/MySQL/
Information: Copying folder mysql\data to     C:/Users/ksaleh.CORP/AppData/Local/dftmp/Resources/d3fdb9aa-67b5-4dad-9c50-0d5116ded0bc/directory/MySQLDatastore/
Information: MySQLIP=127.255.0.0
Information: MySQLPort=20001
Information: Copy C:/Users/ksaleh.CORP/AppData/Local/dftmp/Resources/d3fdb9aa-67b5-4dad-9c50-  0d5116ded0bc/directory/MySQL/my.ini
Information: Starting mysqld C:/Users/ksaleh.CORP/AppData/Local/dftmp/Resources/d3fdb9aa-67b5-4dad-9c50-0d5116ded0bc/directory/MySQL/bin/mysqld.exe
 Information: Arguments --init-file=C:\\Users\\ksaleh.CORP\\AppData\\Local\\dftmp\\Resources\\d3fdb9aa-67b5-4dad-9c50-0d5116ded0bc\\directory\\MySQL\\
Information: enter looping
Information: Working

上記のように、connectDB.php をホストとして 127.255.0.0:20001 を使用するように変更しましたが、「データベースへの接続中にエラーが発生しました!」というメッセージが表示されます。マシンのイベント ビューアを確認したところ、次のエラーが見つかりました。

C:/Users/myuser/AppData/Local/dftmp/Resources/d3fdb9aa-67b5-4dad-9c50-0d5116ded0bc/directory/MySQL/bin/mysqld.exe: unknown option '--skip-locking' 

mysqlid.exeのシャットダウンが完了したと表示されます

本当に mysql ローカル (コンピューティング エミュレーター) をインストールしましたか? はいの場合、なぜサービスが停止したのですか? データベースに接続できないのはなぜですか? すべてが正常であることを確認するにはどうすればよいですか? アドバイスありがとうございます。

4

1 に答える 1

0

お客様のコメントと Java/PHP/MySQL を使用するという要件に基づいて、Windows Azure ワーカー ロールを使用するよりも、Windows Azure 仮想マシンを使用することをお勧めします。

Windows Azure 仮想マシンは、インストール スクリプトを自動化する必要がなく、同じワーカー ロールを管理およびスケーリングできるため、プロジェクトのワーカー ロールよりも優れています。構成は次のとおりです。

  1. PHP/Java インスタンスを構成するための Windows Azure VM (Linux または Windows) を用意する
  2. MySQL インスタンスを構成するための Windows Azure VM (Linux または Windows) を用意する

Windows VM のインスタンスに RDP で仮想マシンにアプリケーションをインストール/構成できます。Linux では、Putty を使用してアプリケーションをインストール/構成できます。これらの VM は永続的であるため、すべてのインストールが持続し、この点に関して何も自動化する必要はありません。

より多くのリソースが必要な場合は、Web インスタンスにインスタンスを追加してください。複数のインスタンスで MySQL をどのように処理するかはわかりません。これは、将来 (ワーカー ロールと Azure VM の両方で) 考える必要があるものです。

Java で Windows Azure VM を使用するための出発点は次のとおりです: https://www.windowsazure.com/en-us/develop/java/tutorials/tomcat-on-a-virtual-machine/

最後に、Java/PHP/MySQL プロジェクトに取り組む必要がある場合は、Windows Azure Virtual Machines を選びます (可能であれば、MySQL を SQL Azure に置き換えるので、データベースのスケーラビリティについて心配する必要はありませんが、MySQL も最良の選択です)。

于 2012-06-21T20:35:02.997 に答える