mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-2.1' into trunk
This commit is contained in:
commit
bafde3d66c
|
|
@ -35,8 +35,7 @@ goto runLegacy
|
||||||
REM -----------------------------------------------------------------------------
|
REM -----------------------------------------------------------------------------
|
||||||
:runPowerShell
|
:runPowerShell
|
||||||
echo Detected powershell execution permissions. Running with enhanced startup scripts.
|
echo Detected powershell execution permissions. Running with enhanced startup scripts.
|
||||||
echo starting ps1: %CASSANDRA_HOME%/bin/cassandra.ps1
|
powershell /file %CASSANDRA_HOME%\bin\cassandra.ps1 %*
|
||||||
powershell /file %CASSANDRA_HOME%/bin/cassandra.ps1 %*
|
|
||||||
goto finally
|
goto finally
|
||||||
|
|
||||||
REM -----------------------------------------------------------------------------
|
REM -----------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ Function Main
|
||||||
{
|
{
|
||||||
ValidateArguments
|
ValidateArguments
|
||||||
|
|
||||||
. "$env:CASSANDRA_HOME/bin/source-conf.ps1"
|
. "$env:CASSANDRA_HOME\bin\source-conf.ps1"
|
||||||
$conf = Find-Conf
|
$conf = Find-Conf
|
||||||
if ($verbose)
|
if ($verbose)
|
||||||
{
|
{
|
||||||
|
|
@ -75,7 +75,7 @@ Function Main
|
||||||
. $conf
|
. $conf
|
||||||
|
|
||||||
SetCassandraEnvironment
|
SetCassandraEnvironment
|
||||||
$pidfile = "$env:CASSANDRA_HOME/$pidfile"
|
$pidfile = "$env:CASSANDRA_HOME\$pidfile"
|
||||||
|
|
||||||
$logdir = "$env:CASSANDRA_HOME/logs"
|
$logdir = "$env:CASSANDRA_HOME/logs"
|
||||||
$storagedir = "$env:CASSANDRA_HOME/data"
|
$storagedir = "$env:CASSANDRA_HOME/data"
|
||||||
|
|
@ -93,7 +93,7 @@ Function Main
|
||||||
if ($p)
|
if ($p)
|
||||||
{
|
{
|
||||||
$pidfile = "$p"
|
$pidfile = "$p"
|
||||||
$env:CASSANDRA_PARAMS = $env:CASSANDRA_PARAMS + " -Dcassandra-pidfile=$pidfile"
|
$env:CASSANDRA_PARAMS = $env:CASSANDRA_PARAMS + ' -Dcassandra-pidfile="' + "$pidfile" + '"'
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($install -or $uninstall)
|
if ($install -or $uninstall)
|
||||||
|
|
@ -110,32 +110,55 @@ Function Main
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
Function HandleInstallation
|
Function HandleInstallation
|
||||||
{
|
{
|
||||||
$SERVICE_JVM = "cassandra"
|
$SERVICE_JVM = """cassandra"""
|
||||||
$PATH_PRUNSRV = "$env:CASSANDRA_HOME/bin/daemon/"
|
$PATH_PRUNSRV = "$env:CASSANDRA_HOME\bin\daemon"
|
||||||
$PR_LOGPATH = $serverPath
|
$PR_LOGPATH = $serverPath
|
||||||
|
|
||||||
|
if (-Not (Test-Path $PATH_PRUNSRV\prunsrv.exe))
|
||||||
|
{
|
||||||
|
Write-Warning "Cannot find $PATH_PRUNSRV\prunsrv.exe. Please download package from http://www.apache.org/dist/commons/daemon/binaries/windows/ to install as a service."
|
||||||
|
Break
|
||||||
|
}
|
||||||
|
|
||||||
|
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))
|
||||||
|
{
|
||||||
|
Write-Warning "Cannot perform installation without admin credentials. Please re-run as administrator."
|
||||||
|
Break
|
||||||
|
}
|
||||||
if (!$env:PRUNSRV)
|
if (!$env:PRUNSRV)
|
||||||
{
|
{
|
||||||
$env:PRUNSRV="$PATH_PRUNSRV/prunsrv"
|
$env:PRUNSRV="$PATH_PRUNSRV\prunsrv"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$regPath = "HKLM:\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\"
|
||||||
|
|
||||||
echo "Attempting to delete existing $SERVICE_JVM service..."
|
echo "Attempting to delete existing $SERVICE_JVM service..."
|
||||||
Start-Sleep -s 2
|
Start-Sleep -s 2
|
||||||
$proc = Start-Process -FilePath "$env:PRUNSRV" -ArgumentList "//DS//$SERVICE_JVM" -PassThru -WindowStyle Hidden
|
$proc = Start-Process -FilePath "$env:PRUNSRV" -ArgumentList "//DS//$SERVICE_JVM" -PassThru -WindowStyle Hidden
|
||||||
|
|
||||||
|
echo "Reverting to default TCP keepalive settings (2 hour timeout)"
|
||||||
|
Remove-ItemProperty -Path $regPath -Name KeepAliveTime -EA SilentlyContinue
|
||||||
|
|
||||||
# Quit out if this is uninstall only
|
# Quit out if this is uninstall only
|
||||||
if ($uninstall)
|
if ($uninstall)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
echo "Installing [$SERVICE_JVM]. If you get registry warnings, re-run as an Administrator"
|
echo "Installing [$SERVICE_JVM]."
|
||||||
Start-Sleep -s 2
|
Start-Sleep -s 2
|
||||||
$proc = Start-Process -FilePath "$env:PRUNSRV" -ArgumentList "//IS//$SERVICE_JVM" -PassThru -WindowStyle Hidden
|
$proc = Start-Process -FilePath "$env:PRUNSRV" -ArgumentList "//IS//$SERVICE_JVM" -PassThru -WindowStyle Hidden
|
||||||
|
|
||||||
echo "Setting the parameters for [$SERVICE_JVM]"
|
echo "Setting launch parameters for [$SERVICE_JVM]"
|
||||||
Start-Sleep -s 2
|
Start-Sleep -s 2
|
||||||
|
|
||||||
|
# Change delim from " -" to ";-" in JVM_OPTS for prunsrv
|
||||||
|
$env:JVM_OPTS = $env:JVM_OPTS -replace " -", ";-"
|
||||||
|
$env:JVM_OPTS = $env:JVM_OPTS -replace " -", ";-"
|
||||||
|
|
||||||
|
# Strip off leading ; if it's there
|
||||||
|
$env:JVM_OPTS = $env:JVM_OPTS.TrimStart(";")
|
||||||
|
|
||||||
# Broken multi-line for convenience - glued back together in a bit
|
# Broken multi-line for convenience - glued back together in a bit
|
||||||
$args = @"
|
$args = @"
|
||||||
//US//$SERVICE_JVM
|
//US//$SERVICE_JVM
|
||||||
|
|
@ -144,11 +167,14 @@ Function HandleInstallation
|
||||||
--StartMode=jvm --StartClass=$env:CASSANDRA_MAIN --StartMethod=main
|
--StartMode=jvm --StartClass=$env:CASSANDRA_MAIN --StartMethod=main
|
||||||
--StopMode=jvm --StopClass=$env:CASSANDRA_MAIN --StopMethod=stop
|
--StopMode=jvm --StopClass=$env:CASSANDRA_MAIN --StopMethod=stop
|
||||||
++JvmOptions=$env:JVM_OPTS ++JvmOptions=-DCassandra
|
++JvmOptions=$env:JVM_OPTS ++JvmOptions=-DCassandra
|
||||||
--PidFile $pidfile
|
--PidFile "$pidfile"
|
||||||
"@
|
"@
|
||||||
$args = $args -replace [Environment]::NewLine, ""
|
$args = $args -replace [Environment]::NewLine, ""
|
||||||
$proc = Start-Process -FilePath "$env:PRUNSRV" -ArgumentList $args -PassThru -WindowStyle Hidden
|
$proc = Start-Process -FilePath "$env:PRUNSRV" -ArgumentList $args -PassThru -WindowStyle Hidden
|
||||||
|
|
||||||
|
echo "Setting KeepAliveTimer to 5 minutes for TCP keepalive"
|
||||||
|
Set-ItemProperty -Path $regPath -Name KeepAliveTime -Value 300000
|
||||||
|
|
||||||
echo "Installation of [$SERVICE_JVM] is complete"
|
echo "Installation of [$SERVICE_JVM] is complete"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,15 +39,15 @@ Function SetCassandraMain()
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
Function BuildClassPath
|
Function BuildClassPath
|
||||||
{
|
{
|
||||||
$cp = "$env:CASSANDRA_HOME/conf"
|
$cp = "$env:CASSANDRA_HOME\conf"
|
||||||
foreach ($file in Get-ChildItem "$env:CASSANDRA_HOME/lib/*.jar")
|
foreach ($file in Get-ChildItem "$env:CASSANDRA_HOME\lib\*.jar")
|
||||||
{
|
{
|
||||||
$file = $file -replace "\\", "/"
|
$file = $file -replace "\\", "/"
|
||||||
$cp = $cp + ";" + "$file"
|
$cp = $cp + ";" + """$file"""
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add build/classes/main so it works in development
|
# Add build/classes/main so it works in development
|
||||||
$cp = $cp + ";" + "$env:CASSANDRA_HOME/build/classes/main;$env:CASSANDRA_HOME/build/classes/thrift"
|
$cp = $cp + ";" + "$env:CASSANDRA_HOME\build\classes\main;$env:CASSANDRA_HOME\build\classes\thrift"
|
||||||
$env:CLASSPATH=$cp
|
$env:CLASSPATH=$cp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -174,7 +174,7 @@ Function SetCassandraEnvironment
|
||||||
echo "Setting up Cassandra environment"
|
echo "Setting up Cassandra environment"
|
||||||
if (Test-Path Env:\JAVA_HOME)
|
if (Test-Path Env:\JAVA_HOME)
|
||||||
{
|
{
|
||||||
$env:JAVA_BIN = "$env:JAVA_HOME/bin/java.exe"
|
$env:JAVA_BIN = "$env:JAVA_HOME\bin\java.exe"
|
||||||
}
|
}
|
||||||
elseif (Get-Command "java.exe")
|
elseif (Get-Command "java.exe")
|
||||||
{
|
{
|
||||||
|
|
@ -186,7 +186,7 @@ Function SetCassandraEnvironment
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
SetCassandraHome
|
SetCassandraHome
|
||||||
$env:CASSANDRA_CONF = "$env:CASSANDRA_HOME/conf"
|
$env:CASSANDRA_CONF = "$env:CASSANDRA_HOME\conf"
|
||||||
$env:CASSANDRA_PARAMS="-Dcassandra -Dlogback.configurationFile=logback.xml"
|
$env:CASSANDRA_PARAMS="-Dcassandra -Dlogback.configurationFile=logback.xml"
|
||||||
SetCassandraMain
|
SetCassandraMain
|
||||||
BuildClassPath
|
BuildClassPath
|
||||||
|
|
@ -215,7 +215,7 @@ Function SetCassandraEnvironment
|
||||||
if (($env:JVM_VENDOR -ne "OpenJDK") -or ($env:JVM_VERSION.CompareTo("1.6.0") -eq 1) -or
|
if (($env:JVM_VENDOR -ne "OpenJDK") -or ($env:JVM_VERSION.CompareTo("1.6.0") -eq 1) -or
|
||||||
(($env:JVM_VERSION -eq "1.6.0") -and ($env:JVM_PATCH_VERSION.CompareTo("22") -eq 1)))
|
(($env:JVM_VERSION -eq "1.6.0") -and ($env:JVM_PATCH_VERSION.CompareTo("22") -eq 1)))
|
||||||
{
|
{
|
||||||
$env:JVM_OPTS = "$env:JVM_OPTS -javaagent:$env:CASSANDRA_HOME/lib/jamm-0.2.6.jar"
|
$env:JVM_OPTS = "$env:JVM_OPTS -javaagent:""$env:CASSANDRA_HOME\lib\jamm-0.2.6.jar"""
|
||||||
}
|
}
|
||||||
|
|
||||||
# enable assertions. disabling this in production will give a modest
|
# enable assertions. disabling this in production will give a modest
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue