This is an automated email from the ASF dual-hosted git repository. adelapena pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/cassandra.git
The following commit(s) were added to refs/heads/trunk by this push: new d9e2ed0 Remove windows scripts and their references d9e2ed0 is described below commit d9e2ed00afd8fae4bcbec02a4b323e55e4f43d88 Author: Yuki Morishita <mor.y...@gmail.com> AuthorDate: Wed Dec 2 16:43:45 2020 +0000 Remove windows scripts and their references patch by Yuki Morishita; reviewed by Berenguer Blasi and Andrés de la Peña for CASSANDRA-16171 --- CHANGES.txt | 1 + NEWS.txt | 9 +- README.asc | 8 - bin/cassandra.bat | 184 -------------- bin/cassandra.in.bat | 74 ------ bin/cassandra.ps1 | 390 ----------------------------- bin/cqlsh.bat | 34 --- bin/debug-cql.bat | 39 --- bin/nodetool.bat | 38 --- bin/source-conf.ps1 | 57 ----- bin/sstableloader.bat | 41 --- bin/sstablescrub.bat | 41 --- bin/sstableupgrade.bat | 41 --- bin/sstableutil.bat | 41 --- bin/sstableverify.bat | 48 ---- bin/stop-server.bat | 55 ---- bin/stop-server.ps1 | 193 -------------- build.xml | 12 +- conf/cassandra-env.ps1 | 469 ----------------------------------- doc/source/operating/security.rst | 4 +- pylib/cqlshlib/test/run_cqlsh.py | 2 - redhat/cassandra.spec | 6 +- tools/bin/auditlogviewer.bat | 41 --- tools/bin/cassandra-stress.bat | 22 -- tools/bin/cassandra.in.bat | 45 ---- tools/bin/fqltool.bat | 36 --- tools/bin/jmxtool.bat | 36 --- tools/bin/sstabledump.bat | 48 ---- tools/bin/sstableexpiredblockers.bat | 23 -- tools/bin/sstablelevelreset.bat | 46 ---- tools/bin/sstablemetadata.bat | 23 -- tools/bin/sstableofflinerelevel.bat | 49 ---- tools/bin/sstablerepairedset.bat | 46 ---- tools/bin/sstablesplit.bat | 41 --- 34 files changed, 15 insertions(+), 2228 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index a51d471..ce649c8 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,4 +1,5 @@ 4.0-beta4 + * Remove Windows scripts (CASSANDRA-16171) * Improve checksumming and compression in protocol V5 (CASSANDRA-15299) * Optimised repair streaming improvements (CASSANDRA-16274) * Update jctools dependency to 3.1.0 (CASSANDRA-16255) diff --git a/NEWS.txt b/NEWS.txt index d02f2f0..987a6b6 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -258,7 +258,6 @@ Upgrading If it is not defined, or not equal to the numbers of tokens defined in initial_tokens, the node will not start. See CASSANDRA-14477 for details. - Deprecation ----------- @@ -266,7 +265,6 @@ Deprecation deprecated in favor of org.apache.cassandra.db:type=DisallowedDirectories and will be removed in a subsequent major version. - Materialized Views ------------------- - Following a discussion regarding concerns about the design and safety of Materialized Views, the C* development @@ -278,6 +276,13 @@ Materialized Views to be NOT NULL, and no base primary key columns get automatically included in view definition. You have to specify them explicitly now. +Windows Support Removed +----------------------- + - Due to the lack of maintenance and testing, Windows support is removed from this version onward. The developers + who use Windows 10 still can run Apache Cassandra locally using WSL2 (Windows Subsystem for Linux version 2), + Docker for Windows, or virtualization platform like Hyper-V and VirtualBox. + + 3.11.10 ====== diff --git a/README.asc b/README.asc index b7ec492..194b1ee 100644 --- a/README.asc +++ b/README.asc @@ -30,14 +30,6 @@ Cassandra to remain in the foreground and log to standard out; it can be stopped $ bin/cassandra -f -**** -Note for Windows users: to install Cassandra as a service, download -http://commons.apache.org/daemon/procrun.html[Procrun], set the -PRUNSRV environment variable to the full path of prunsrv (e.g., -C:\procrun\prunsrv.exe), and run "bin\cassandra.bat install". -Similarly, "uninstall" will remove the service. -**** - Now let's try to read and write some data using the Cassandra Query Language: $ bin/cqlsh diff --git a/bin/cassandra.bat b/bin/cassandra.bat deleted file mode 100644 index 24889d8..0000000 --- a/bin/cassandra.bat +++ /dev/null @@ -1,184 +0,0 @@ -@REM -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off -if "%OS%" == "Windows_NT" setlocal - -set ARG=%1 -set INSTALL="INSTALL" -set UNINSTALL="UNINSTALL" - -pushd %~dp0.. -if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%CD% -popd - -if /i "%ARG%" == "LEGACY" goto runLegacy -REM ----------------------------------------------------------------------------- -REM See if we have access to run unsigned powershell scripts -for /F "delims=" %%i in ('powershell Get-ExecutionPolicy') do set PERMISSION=%%i -if "%PERMISSION%" == "Unrestricted" goto runPowerShell -goto runLegacy - -REM ----------------------------------------------------------------------------- -:runPowerShell -echo Detected powershell execution permissions. Running with enhanced startup scripts. -set errorlevel= -powershell /file "%CASSANDRA_HOME%\bin\cassandra.ps1" %* -exit /b %errorlevel% - -REM ----------------------------------------------------------------------------- -:runLegacy -echo WARNING! Powershell script execution unavailable. -echo Please use 'powershell Set-ExecutionPolicy Unrestricted' -echo on this user-account to run cassandra with fully featured -echo functionality on this platform. - -echo Starting with legacy startup options - -if NOT DEFINED CASSANDRA_MAIN set CASSANDRA_MAIN=org.apache.cassandra.service.CassandraDaemon -if NOT DEFINED JAVA_HOME goto :err - -REM ----------------------------------------------------------------------------- -REM JVM Opts we'll use in legacy run or installation -set JAVA_OPTS=-ea^ - -javaagent:"%CASSANDRA_HOME%\lib\jamm-0.3.2"^ - -Xms2G^ - -Xmx2G^ - -XX:+HeapDumpOnOutOfMemoryError^ - -XX:+UseParNewGC^ - -XX:+UseConcMarkSweepGC^ - -XX:+CMSParallelRemarkEnabled^ - -XX:SurvivorRatio=8^ - -XX:MaxTenuringThreshold=1^ - -XX:CMSInitiatingOccupancyFraction=75^ - -XX:+UseCMSInitiatingOccupancyOnly^ - -Dlogback.configurationFile=logback.xml^ - -Djava.library.path="%CASSANDRA_HOME%\lib\sigar-bin"^ - -Dcassandra.jmx.local.port=7199 -REM **** JMX REMOTE ACCESS SETTINGS SEE: https://wiki.apache.org/cassandra/JmxSecurity *** -REM -Dcom.sun.management.jmxremote.port=7199^ -REM -Dcom.sun.management.jmxremote.ssl=false^ -REM -Dcom.sun.management.jmxremote.authenticate=true^ -REM -Dcom.sun.management.jmxremote.password.file=C:\jmxremote.password - -REM ***** CLASSPATH library setting ***** -REM Ensure that any user defined CLASSPATH variables are not used on startup -set CLASSPATH="%CASSANDRA_HOME%\conf" - -REM For each jar in the CASSANDRA_HOME lib directory call append to build the CLASSPATH variable. -for %%i in ("%CASSANDRA_HOME%\lib\*.jar") do call :append "%%i" -goto okClasspath - -:append -set CLASSPATH=%CLASSPATH%;%1 -goto :eof - -REM ----------------------------------------------------------------------------- -:okClasspath - -REM JSR223 - collect all JSR223 engines' jars -for /D %%P in ("%CASSANDRA_HOME%\lib\jsr223\*.*") do ( - for %%i in ("%%P\*.jar") do call :append "%%i" -) - -REM JSR223/JRuby - set ruby lib directory -if EXIST "%CASSANDRA_HOME%\lib\jsr223\jruby\ruby" ( - set JAVA_OPTS=%JAVA_OPTS% "-Djruby.lib=%CASSANDRA_HOME%\lib\jsr223\jruby" -) -REM JSR223/JRuby - set ruby JNI libraries root directory -if EXIST "%CASSANDRA_HOME%\lib\jsr223\jruby\jni" ( - set JAVA_OPTS=%JAVA_OPTS% "-Djffi.boot.library.path=%CASSANDRA_HOME%\lib\jsr223\jruby\jni" -) -REM JSR223/Jython - set python.home system property -if EXIST "%CASSANDRA_HOME%\lib\jsr223\jython\jython.jar" ( - set JAVA_OPTS=%JAVA_OPTS% "-Dpython.home=%CASSANDRA_HOME%\lib\jsr223\jython" -) -REM JSR223/Scala - necessary system property -if EXIST "%CASSANDRA_HOME%\lib\jsr223\scala\scala-compiler.jar" ( - set JAVA_OPTS=%JAVA_OPTS% "-Dscala.usejavacp=true" -) - -REM Include the build\classes\main directory so it works in development -set CASSANDRA_CLASSPATH=%CLASSPATH%;"%CASSANDRA_HOME%\build\classes\main" -set CASSANDRA_PARAMS=-Dcassandra -Dcassandra-foreground=yes -set CASSANDRA_PARAMS=%CASSANDRA_PARAMS% -Dcassandra.logdir="%CASSANDRA_HOME%\logs" -set CASSANDRA_PARAMS=%CASSANDRA_PARAMS% -Dcassandra.storagedir="%CASSANDRA_HOME%\data" - -if /i "%ARG%" == "INSTALL" goto doInstallOperation -if /i "%ARG%" == "UNINSTALL" goto doInstallOperation - -echo Starting Cassandra Server -"%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp %CASSANDRA_CLASSPATH% "%CASSANDRA_MAIN%" -goto finally - -REM ----------------------------------------------------------------------------- -:doInstallOperation -set SERVICE_JVM="cassandra" -rem location of Prunsrv -set PATH_PRUNSRV=%CASSANDRA_HOME%\bin\daemon\ -set PR_LOGPATH=%PATH_PRUNSRV% - -rem Allow prunsrv to be overridden -if "%PRUNSRV%" == "" set PRUNSRV=%PATH_PRUNSRV%prunsrv - -echo trying to delete service if it has been created already -"%PRUNSRV%" //DS//%SERVICE_JVM% -rem quit if we're just going to uninstall -if /i "%ARG%" == "UNINSTALL" goto finally - -echo Installing %SERVICE_JVM%. If you get registry warnings, re-run as an Administrator -"%PRUNSRV%" //IS//%SERVICE_JVM% - -echo Setting startup parameters for %SERVICE_JVM% -set cmd="%PRUNSRV%" //US//%SERVICE_JVM% ^ - --Jvm=auto --StdOutput auto --StdError auto ^ - --Classpath=%CASSANDRA_CLASSPATH% ^ - --StartMode=jvm --StartClass=%CASSANDRA_MAIN% --StartMethod=main ^ - --StopMode=jvm --StopClass=%CASSANDRA_MAIN% --StopMethod=stop - -REM convert ' -' into ';-' so we can tokenize on semicolon as we may have spaces in folder names -set tempOptions=%JAVA_OPTS: -=;-% -REM Append the JAVA_OPTS, each with independent ++JvmOptions as delimited list fails for some options -:optStrip -for /F "tokens=1* delims=;" %%a in ("%tempOptions%") do ( - set JVMOPTIONS=%JVMOPTIONS% ++JvmOptions=%%a - set tempOptions=%%b -) -if defined tempOptions goto :optStrip - -REM do the same for CASSANDRA_PARAMS -set tempOptions=%CASSANDRA_PARAMS: -=;-% - -:paramStrip -for /F "tokens=1* delims=;" %%a in ("%tempOptions%") do ( - set JVMOPTIONS=%JVMOPTIONS% ++JvmOptions=%%a - set tempOptions=%%b -) -if defined tempOptions goto :paramStrip - -%cmd% %JVMOPTIONS% - -echo Installation of %SERVICE_JVM% is complete -goto finally - -:err -echo JAVA_HOME environment variable must be set! -pause - -REM ----------------------------------------------------------------------------- -:finally - -ENDLOCAL diff --git a/bin/cassandra.in.bat b/bin/cassandra.in.bat deleted file mode 100644 index 0e760a0..0000000 --- a/bin/cassandra.in.bat +++ /dev/null @@ -1,74 +0,0 @@ -@REM -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off -pushd %~dp0.. -if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%CD% -popd - -if NOT DEFINED CASSANDRA_CONF set CASSANDRA_CONF="%CASSANDRA_HOME%\conf" - -REM the default location for commitlogs, sstables, and saved caches -REM if not set in cassandra.yaml -set cassandra_storagedir="%CASSANDRA_HOME%\data" - -REM JAVA_HOME can optionally be set here -REM set JAVA_HOME="<directory>" - -REM ***** CLASSPATH library setting ***** - -REM Ensure that any user defined CLASSPATH variables are not used on startup -set CLASSPATH=%CASSANDRA_CONF% - -REM For each jar in the CASSANDRA_HOME lib directory call append to build the CLASSPATH variable. -for %%i in ("%CASSANDRA_HOME%\lib\*.jar") do call :append "%%i" -goto :okClasspath - -:append -set CLASSPATH=%CLASSPATH%;%1 -goto :eof - -:okClasspath - -REM Include the build\classes\main directory so it works in development -set CASSANDRA_CLASSPATH=%CLASSPATH%;"%CASSANDRA_HOME%\build\classes\main";%CASSANDRA_CONF% - -REM Add the default storage location. Can be overridden in conf\cassandra.yaml -set CASSANDRA_PARAMS=%CASSANDRA_PARAMS% "-Dcassandra.storagedir=%CASSANDRA_HOME%\data" - -REM JSR223 - collect all JSR223 engines' jars -for /r %%P in ("%CASSANDRA_HOME%\lib\jsr223\*.jar") do ( - set CLASSPATH=%CLASSPATH%;%%~fP -) -REM JSR223/JRuby - set ruby lib directory -if EXIST "%CASSANDRA_HOME%\lib\jsr223\jruby\ruby" ( - set JAVA_OPTS=%JAVA_OPTS% "-Djruby.lib=%CASSANDRA_HOME%\lib\jsr223\jruby" -) -REM JSR223/JRuby - set ruby JNI libraries root directory -if EXIST "%CASSANDRA_HOME%\lib\jsr223\jruby\jni" ( - set JAVA_OPTS=%JAVA_OPTS% "-Djffi.boot.library.path=%CASSANDRA_HOME%\lib\jsr223\jruby\jni" -) -REM JSR223/Jython - set python.home system property -if EXIST "%$CASSANDRA_HOME%\lib\jsr223\jython\jython.jar" ( - set JAVA_OPTS=%JAVA_OPTS% "-Dpython.home=%CASSANDRA_HOME%\lib\jsr223\jython" -) -REM JSR223/Scala - necessary system property -if EXIST "$CASSANDRA_HOME\lib\jsr223\scala\scala-compiler.jar" ( - set JAVA_OPTS=%JAVA_OPTS% "-Dscala.usejavacp=true" -) - -REM Add the sigar-bin path to the java.library.path CASSANDRA-7838 -set JAVA_OPTS=%JAVA_OPTS% -Djava.library.path=%CASSANDRA_HOME%\lib\sigar-bin" diff --git a/bin/cassandra.ps1 b/bin/cassandra.ps1 deleted file mode 100644 index 6e6a3cf..0000000 --- a/bin/cassandra.ps1 +++ /dev/null @@ -1,390 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#----------------------------------------------------------------------------- -Function PrintUsage -{ - echo @" -usage: cassandra.ps1 [-f] [-h] [-q] [-a] [-p pidfile] [-H dumpfile] [-D arg] [-E errorfile] [-install | -uninstall] [-help] - -f Run cassandra in foreground - -install install cassandra as a service - -uninstall remove cassandra service - -p pidfile tracked by server and removed on close (defaults to pid.txt) - -H change JVM HeapDumpPath - -D items to append to JVM_OPTS - -E change JVM ErrorFile - -v Print cassandra version and exit - -s Show detailed jvm environment information during launch - -a Aggressive startup. Skip VerifyPorts check. For use in dev environments. - -q Quiet output. Does not print stdout/stderr to console (when run without -f) - -help print this message - - NOTE: installing cassandra as a service requires Commons Daemon Service Runner - available at http://commons.apache.org/proper/commons-daemon/" -"@ - exit -} - -#----------------------------------------------------------------------------- -Function Main -{ - ValidateArguments - - # support direct run of .ps1 file w/out batch file - if ($env:CASSANDRA_HOME -eq $null) - { - $scriptDir = Split-Path $script:MyInvocation.MyCommand.Path - $env:CASSANDRA_HOME = (Get-Item $scriptDir).parent.FullName - } - . "$env:CASSANDRA_HOME\bin\source-conf.ps1" - - $conf = Find-Conf - if ($s) - { - echo "Sourcing cassandra config file: $conf" - } - . $conf - - SetCassandraEnvironment - if ($v) - { - PrintVersion - exit - } - $pidfile = "$env:CASSANDRA_HOME\$pidfile" - - # Other command line params - if ($H) - { - $env:JVM_OPTS = $env:JVM_OPTS + " -XX:HeapDumpPath=$H" - } - if ($E) - { - $env:JVM_OPTS = $env:JVM_OPTS + " -XX:ErrorFile=$E" - } - if ($p) - { - $pidfile = "$p" - $env:CASSANDRA_PARAMS = $env:CASSANDRA_PARAMS + ' -Dcassandra-pidfile="' + "$pidfile" + '"' - } - - # Parse -D and -X JVM_OPTS - for ($i = 0; $i -lt $script:args.Length; ++$i) - { - if ($script:args[$i].StartsWith("-D") -Or $script:args[$i].StartsWith("-X")) - { - $env:JVM_OPTS = "$env:JVM_OPTS " + $script:args[$i] - } - } - - if ($install -or $uninstall) - { - HandleInstallation - } - else - { - VerifyPortsAreAvailable - RunCassandra($f) - } -} - -#----------------------------------------------------------------------------- -Function HandleInstallation -{ - $SERVICE_JVM = """cassandra""" - $PATH_PRUNSRV = "$env:CASSANDRA_HOME\bin\daemon" - $PR_LOGPATH = $serverPath - - if (-Not (Test-Path $PATH_PRUNSRV\prunsrv.exe)) - { - Write-Warning "Cannot find $PATH_PRUNSRV\prunsrv.exe. Please download package from https://downloads.apache.org/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) - { - $env:PRUNSRV="$PATH_PRUNSRV\prunsrv" - } - - $regPath = "HKLM:\SYSTEM\CurrentControlSet\services\Tcpip\Parameters\" - - echo "Attempting to delete existing $SERVICE_JVM service..." - Start-Sleep -s 2 - $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 - if ($uninstall) - { - return - } - - echo "Installing [$SERVICE_JVM]." - Start-Sleep -s 2 - $proc = Start-Process -FilePath "$env:PRUNSRV" -ArgumentList "//IS//$SERVICE_JVM" -PassThru -WindowStyle Hidden - - echo "Setting launch parameters for [$SERVICE_JVM]" - Start-Sleep -s 2 - - $args = @" -//US//$SERVICE_JVM - --Jvm=auto --StdOutput auto --StdError auto - --Classpath=$env:CLASSPATH - --StartMode=jvm --StartClass=$env:CASSANDRA_MAIN --StartMethod=main - --StopMode=jvm --StopClass=$env:CASSANDRA_MAIN --StopMethod=stop - --PidFile "$pidfile" -"@ - - # Include cassandra params - $prunArgs = "$env:CASSANDRA_PARAMS $env:JVM_OPTS" - - # Change to semicolon delim as we can't split on space due to potential spaces in directory names - $prunArgs = $prunArgs -replace " -", ";-" - - # JvmOptions w/multiple semicolon delimited items isn't working correctly. storagedir and logdir were - # both being ignored / failing to parse on startup. See CASSANDRA-8115 - $split_opts = $prunArgs.Split(";") - foreach ($arg in $split_opts) - { - $args += " ++JvmOptions=$arg" - } - - $args = $args -replace [Environment]::NewLine, "" - $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" -} - -#----------------------------------------------------------------------------- -Function PrintVersion() -{ - Write-Host "Cassandra Version: " -NoNewLine - $pinfo = New-Object System.Diagnostics.ProcessStartInfo - $pinfo.FileName = "$env:JAVA_BIN" - $pinfo.UseShellExecute = $false - $pinfo.Arguments = "-Dlogback.configurationFile=logback-tools.xml -cp $env:CLASSPATH org.apache.cassandra.tools.GetVersion" - $p = New-Object System.Diagnostics.Process - $p.StartInfo = $pinfo - $p.Start() | Out-Null - $p.WaitForExit() -} - -#----------------------------------------------------------------------------- -Function RunCassandra([string]$foreground) -{ - $cmd = @" -$env:JAVA_BIN -"@ - $arg1 = $env:CASSANDRA_PARAMS - $arg2 = $env:JVM_OPTS - $arg3 = "-cp $env:CLASSPATH" - $arg4 = @" -"$env:CASSANDRA_MAIN" -"@ - - $proc = $null - - if ($s) - { - echo "Running cassandra with: [$cmd $arg1 $arg2 $arg3 $arg4]" - } - - if ($foreground) - { - $cygwin = $false - try - { - $uname = uname -o - if ($uname.CompareTo("Cygwin") -eq 0) - { - $cygwin = $true - } - } - catch - { - # Failed at uname call, not in cygwin - } - - if ($cygwin) - { - # if running on cygwin, we cannot capture ctrl+c signals as mintty traps them and then - # SIGKILLs processes, so we'll need to record our $pidfile file for future - # stop-server usage - if (!$p) - { - echo "Detected cygwin runtime environment. Adding -Dcassandra-pidfile=$pidfile to JVM params as control+c trapping on mintty is inconsistent" - $arg2 = $arg2 + " -Dcassandra-pidfile=$pidfile" - } - } - - $arg2 = $arg2 + " -Dcassandra-foreground=yes" - - $pinfo = New-Object System.Diagnostics.ProcessStartInfo - $pinfo.FileName = "$env:JAVA_BIN" - $pinfo.RedirectStandardInput = $true - $pinfo.UseShellExecute = $false - $pinfo.Arguments = $arg1,$arg2,$arg3,$arg4 - $p = New-Object System.Diagnostics.Process - $p.StartInfo = $pinfo - $p.Start() | Out-Null - echo $p.Id > $pidfile - $p.WaitForExit() - } - else - { - if ($q) - { - $proc = Start-Process -FilePath "$cmd" -ArgumentList $arg1,$arg2,$arg3,$arg4 -PassThru -WindowStyle Hidden - } - else - { - $proc = Start-Process -FilePath "$cmd" -ArgumentList $arg1,$arg2,$arg3,$arg4 -PassThru -NoNewWindow - } - - $exitCode = $? - - try - { - echo $proc.Id > $pidfile - } - catch - { - echo @" -WARNING! Failed to write pidfile to $pidfile. stop-server.bat and - startup protection will not be available. -"@ - echo $_.Exception.Message - exit 1 - } - - if (-Not $exitCode) - { - exit 1 - } - } -} - -#----------------------------------------------------------------------------- -Function VerifyPortsAreAvailable -{ - if ($a) - { - return - } - # Need to confirm 5 different ports are available or die if any are currently bound - # From cassandra.yaml: - # storage_port - # ssl_storage_port - # native_transport_port - # and from env: JMX_PORT which we cache in our environment during SetCassandraEnvironment for this check - $yamlRegex = "storage_port:|ssl_storage_port:|native_transport_port:" - $yaml = Get-Content "$env:CASSANDRA_CONF\cassandra.yaml" - $portRegex = ":$env:JMX_PORT |" - - foreach ($line in $yaml) - { - if ($line -match $yamlRegex) - { - $sa = $line.Split(":") - $portRegex = $portRegex + ":" + ($sa[1] -replace " ","") + " |" - } - } - $portRegex = $portRegex.Substring(0, $portRegex.Length - 2) - - $netstat = netstat -an - - foreach ($line in $netstat) - { - if ($line -match "TCP" -and $line -match $portRegex) - { - Write-Error "Found a port already in use. Aborting startup" - Write-Error $line - Exit - } - } -} - -#----------------------------------------------------------------------------- -Function ValidateArguments -{ - if ($install -and $uninstall) - { - echo "Cannot install and uninstall" - exit - } - if ($help) - { - PrintUsage - } -} - -#----------------------------------------------------------------------------- -Function CheckEmptyParam($param) -{ - if ([String]::IsNullOrEmpty($param)) - { - echo "Invalid parameter: empty value" - PrintUsage - } -} - -#----------------------------------------------------------------------------- -# Populate arguments -for ($i = 0; $i -lt $args.count; $i++) -{ - # Skip JVM args - if ($args[$i].StartsWith("-D") -Or $args[$i].StartsWith("-X")) - { - continue; - } - Switch($args[$i]) - { - "-install" { $install = $True } - "-uninstall" { $uninstall = $True } - "-help" { PrintUsage } - "-?" { PrintUsage } - "--help" { PrintUsage } - "-v" { $v = $True } - "-f" { $f = $True } - "-s" { $s = $True } - "-p" { $p = $args[++$i]; CheckEmptyParam($p) } - "-H" { $H = $args[++$i]; CheckEmptyParam($H) } - "-E" { $E = $args[++$i]; CheckEmptyParam($E) } - "-a" { $a = $True } - "-q" { $q = $True } - default - { - "Invalid argument: " + $args[$i]; - if (-Not $args[$i].startsWith("-")) - { - echo "Note: All options require -" - } - exit - } - } -} -$pidfile = "pid.txt" - -Main diff --git a/bin/cqlsh.bat b/bin/cqlsh.bat deleted file mode 100644 index 6170373..0000000 --- a/bin/cqlsh.bat +++ /dev/null @@ -1,34 +0,0 @@ -@ECHO OFF -@REM -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off - -if "%OS%" == "Windows_NT" setlocal - -python -V >nul 2>&1 -if ERRORLEVEL 1 goto err - -python "%~dp0\cqlsh.py" %* -goto finally - -:err -echo Can't detect Python version! - -:finally - -ENDLOCAL - diff --git a/bin/debug-cql.bat b/bin/debug-cql.bat deleted file mode 100644 index 121e0c1..0000000 --- a/bin/debug-cql.bat +++ /dev/null @@ -1,39 +0,0 @@ -@REM -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat -if NOT DEFINED CASSANDRA_MAIN set CASSANDRA_MAIN=org.apache.cassandra.transport.Client -if NOT DEFINED JAVA_HOME goto :err - -REM ***** JAVA options ***** -set JAVA_OPTS=^ - -Dlogback.configurationFile=logback-tools.xml - -set TOOLS_PARAMS= -"%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp %CASSANDRA_CLASSPATH% "%CASSANDRA_MAIN%" %* -goto finally - -:err -echo JAVA_HOME environment variable must be set! -pause - -:finally - -ENDLOCAL diff --git a/bin/nodetool.bat b/bin/nodetool.bat deleted file mode 100644 index 1d3c4e5..0000000 --- a/bin/nodetool.bat +++ /dev/null @@ -1,38 +0,0 @@ -@REM -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat - -if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%~dp0.. -if NOT DEFINED JAVA_HOME goto :err - -set CASSANDRA_PARAMS=%CASSANDRA_PARAMS% -Dcassandra.logdir="%CASSANDRA_HOME%\logs" -set CASSANDRA_PARAMS=%CASSANDRA_PARAMS% -Dcassandra.storagedir="%CASSANDRA_HOME%\data" - -"%JAVA_HOME%\bin\java" -cp %CASSANDRA_CLASSPATH% %CASSANDRA_PARAMS% -Dlogback.configurationFile=logback-tools.xml org.apache.cassandra.tools.NodeTool %* -goto finally - -:err -echo The JAVA_HOME environment variable must be set to run this program! -pause - -:finally -ENDLOCAL & set RC=%ERRORLEVEL% -exit /B %RC% diff --git a/bin/source-conf.ps1 b/bin/source-conf.ps1 deleted file mode 100644 index 9828787..0000000 --- a/bin/source-conf.ps1 +++ /dev/null @@ -1,57 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -Function Find-Conf -{ - $file = ""; - # Order of preference on grabbing environment settings: - # 1: %CASSANDRA_INCLUDE% - # 2a: %USERPROFILE%/cassandra-env.ps1 (cmd-prompt) - # 2b: $HOME/cassandra-env.ps1 (cygwin) - # 3: %CASSANDRA_HOME%/conf/cassandra-env.ps1 - # 4: Relative to current working directory (../conf) - if (Test-Path Env:\CASSANDRA_INCLUDE) - { - $file = "$env:CASSANDRA_INCLUDE" - } - elseif (Test-Path "$env:USERPROFILE/cassandra-env.ps1") - { - $file = "$env:USERPROFILE/cassandra-env.ps1" - } - elseif (Test-Path "$env:HOME/cassandra-env.ps1") - { - $file = "$env:HOME/cassandra-env.ps1" - } - elseif (Test-Path Env:\CASSANDRA_HOME) - { - $file = "$env:CASSANDRA_HOME/conf/cassandra-env.ps1" - } - else - { - $file = [System.IO.Directory]::GetCurrentDirectory() + "/../conf/cassandra-env.ps1" - } - $file = $file -replace "\\", "/" - - if (Test-Path $file) - { - return $file - } - else - { - echo "Error with environment file resolution. Path: [$file] not found." - exit - } -} diff --git a/bin/sstableloader.bat b/bin/sstableloader.bat deleted file mode 100644 index 13293f0..0000000 --- a/bin/sstableloader.bat +++ /dev/null @@ -1,41 +0,0 @@ -@REM -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat - -if NOT DEFINED CASSANDRA_MAIN set CASSANDRA_MAIN=org.apache.cassandra.tools.BulkLoader -if NOT DEFINED JAVA_HOME goto :err - -REM ***** JAVA options ***** -set JAVA_OPTS=^ - -Dlogback.configurationFile=logback-tools.xml - -set TOOLS_PARAMS= - -"%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp %CASSANDRA_CLASSPATH% "%CASSANDRA_MAIN%" %* -goto finally - -:err -echo JAVA_HOME environment variable must be set! -pause - -:finally - -ENDLOCAL diff --git a/bin/sstablescrub.bat b/bin/sstablescrub.bat deleted file mode 100644 index 62c140b..0000000 --- a/bin/sstablescrub.bat +++ /dev/null @@ -1,41 +0,0 @@ -@REM -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat - -if NOT DEFINED CASSANDRA_MAIN set CASSANDRA_MAIN=org.apache.cassandra.tools.StandaloneScrubber -if NOT DEFINED JAVA_HOME goto :err - -REM ***** JAVA options ***** -set JAVA_OPTS=^ - -Dlogback.configurationFile=logback-tools.xml - -set TOOLS_PARAMS= - -"%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp %CASSANDRA_CLASSPATH% "%CASSANDRA_MAIN%" %* -goto finally - -:err -echo JAVA_HOME environment variable must be set! -pause - -:finally - -ENDLOCAL diff --git a/bin/sstableupgrade.bat b/bin/sstableupgrade.bat deleted file mode 100644 index 4025ae8..0000000 --- a/bin/sstableupgrade.bat +++ /dev/null @@ -1,41 +0,0 @@ -@REM -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat - -if NOT DEFINED CASSANDRA_MAIN set CASSANDRA_MAIN=org.apache.cassandra.tools.StandaloneUpgrader -if NOT DEFINED JAVA_HOME goto :err - -REM ***** JAVA options ***** -set JAVA_OPTS=^ - -Dlogback.configurationFile=logback-tools.xml - -set TOOLS_PARAMS= - -"%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp %CASSANDRA_CLASSPATH% "%CASSANDRA_MAIN%" %* -goto finally - -:err -echo JAVA_HOME environment variable must be set! -pause - -:finally - -ENDLOCAL diff --git a/bin/sstableutil.bat b/bin/sstableutil.bat deleted file mode 100644 index bc3eb8a..0000000 --- a/bin/sstableutil.bat +++ /dev/null @@ -1,41 +0,0 @@ -@REM -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat - -if NOT DEFINED CASSANDRA_MAIN set CASSANDRA_MAIN=org.apache.cassandra.tools.StandaloneSSTableUtil -if NOT DEFINED JAVA_HOME goto :err - -REM ***** JAVA options ***** -set JAVA_OPTS=^ - -Dlogback.configurationFile=logback-tools.xml - -set TOOLS_PARAMS= - -"%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp %CASSANDRA_CLASSPATH% "%CASSANDRA_MAIN%" %* -goto finally - -:err -echo JAVA_HOME environment variable must be set! -pause - -:finally - -ENDLOCAL diff --git a/bin/sstableverify.bat b/bin/sstableverify.bat deleted file mode 100644 index eb2629f..0000000 --- a/bin/sstableverify.bat +++ /dev/null @@ -1,48 +0,0 @@ -@REM -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat - -if NOT DEFINED CASSANDRA_MAIN set CASSANDRA_MAIN=org.apache.cassandra.tools.StandaloneVerifier -if NOT DEFINED JAVA_HOME goto :err - -REM ***** JAVA options ***** -set JAVA_OPTS=^ - -Dlogback.configurationFile=logback-tools.xml - -set TOOLS_PARAMS= - -"%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp %CASSANDRA_CLASSPATH% "%CASSANDRA_MAIN%" %* -goto finally - -:err -echo JAVA_HOME environment variable must be set! -set ERRORLEVEL=1 -pause - -:finally -ENDLOCAL & set RC=%ERRORLEVEL% -goto :exit_with_code - -:returncode -exit /B %RC% - -:exit_with_code -call :returncode %RC% diff --git a/bin/stop-server.bat b/bin/stop-server.bat deleted file mode 100644 index acd88d0..0000000 --- a/bin/stop-server.bat +++ /dev/null @@ -1,55 +0,0 @@ -@REM -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off -if "%OS%" == "Windows_NT" setlocal - -pushd %~dp0.. -if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%CD% -popd - -REM ----------------------------------------------------------------------------- -REM See if we have the capabilities of running the powershell scripts -for /F "delims=" %%i in ('powershell Get-ExecutionPolicy') do set PERMISSION=%%i -if "%PERMISSION%" == "Unrestricted" goto runPowerShell -goto runLegacy - -REM ----------------------------------------------------------------------------- -:runPowerShell -REM Need to generate a random title for this command-prompt to determine its pid. -REM We detach and re-attach the console in stop-server.ps1 to send ctrl+c to the -REM running cassandra process and need to re-attach here to print results. -set /A rand=%random% %% (100000 - 1 + 1) + 1 -TITLE %rand% -FOR /F "tokens=2 delims= " %%A IN ('TASKLIST /FI ^"WINDOWTITLE eq %rand%^" /NH') DO set PID=%%A - -REM Start with /B -> the control+c event we generate in stop-server.ps1 percolates -REM up and hits this external batch file if we call powershell directly. -start /WAIT /B powershell /file "%CASSANDRA_HOME%/bin/stop-server.ps1" -batchpid %PID% %* -goto finally - -REM ----------------------------------------------------------------------------- -:runLegacy -echo WARNING! Powershell script execution unavailable. -echo Please use 'powershell Set-ExecutionPolicy Unrestricted' -echo on this user-account to run cassandra with fully featured -echo functionality on this platform. - -echo Cannot stop server without powershell access. -goto finally - -:finally -ENDLOCAL diff --git a/bin/stop-server.ps1 b/bin/stop-server.ps1 deleted file mode 100644 index d1bc952..0000000 --- a/bin/stop-server.ps1 +++ /dev/null @@ -1,193 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -param ( - [string]$p, - [string]$batchpid, - [switch]$f, - [switch]$silent, - [switch]$help -) - -#----------------------------------------------------------------------------- -Function ValidateArguments -{ - if (!$p) - { - PrintUsage - } - if ($help) - { - PrintUsage - } -} - -#----------------------------------------------------------------------------- -Function PrintUsage -{ - echo @" - -usage: stop-server.ps1 -p pidfile -f[-help] - -p pidfile tracked by server and removed on close. - -s Silent. Don't print success/failure data. - -f force kill. -"@ - exit -} - -#----------------------------------------------------------------------------- -Function KillProcess -{ - if (-Not (Test-Path $p)) - { - if (-Not ($silent)) - { - echo "Error - pidfile not found. Aborting." - } - exit - } - - $t = @" - using System; - using System.Diagnostics; - using System.IO; - using System.Runtime.InteropServices; - using System.Threading; - - namespace PowerStopper - { - public static class Stopper - { - delegate bool ConsoleCtrlDelegate(CtrlTypes CtrlType); - - [DllImport("kernel32.dll", SetLastError = true)] - static extern bool AttachConsole(uint dwProcessId); - - [DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)] - static extern bool FreeConsole(); - - enum CtrlTypes : uint - { - CTRL_C_EVENT = 0, - CTRL_BREAK_EVENT, - CTRL_CLOSE_EVENT, - CTRL_LOGOFF_EVENT = 5, - CTRL_SHUTDOWN_EVENT - } - - [DllImport("kernel32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - private static extern bool GenerateConsoleCtrlEvent(CtrlTypes dwCtrlEvent, uint dwProcessGroupId); - - [DllImport("kernel32.dll")] - static extern bool SetConsoleCtrlHandler(ConsoleCtrlDelegate HandlerRoutine, bool Add); - - // Our output gets swallowed on ms-dos as we can't re-attach our console to the output of the cmd - // running the batch file. - public static void StopProgram(int pidToKill, int consolePid, bool silent) - { - Process proc = null; - try - { - proc = Process.GetProcessById(pidToKill); - } - catch (ArgumentException) - { - if (!silent) - System.Console.WriteLine("Process " + pidToKill + " not found. Aborting."); - return; - } - - if (!FreeConsole()) - { - if (!silent) - System.Console.WriteLine("Failed to FreeConsole to attach to running cassandra process. Aborting."); - return; - } - - if (AttachConsole((uint)pidToKill)) - { - //Disable Ctrl-C handling for our program - SetConsoleCtrlHandler(null, true); - GenerateConsoleCtrlEvent(CtrlTypes.CTRL_C_EVENT, 0); - - // Must wait here. If we don't and re-enable Ctrl-C - // handling below too fast, we might terminate ourselves. - bool exited = proc.WaitForExit(30000); - if(!exited) - proc.Kill(); - - FreeConsole(); - - // Re-attach to current console to write output - if (consolePid >= 0) - AttachConsole((uint)consolePid); - - // Re-enable Ctrl-C handling or any subsequently started - // programs will inherit the disabled state. - SetConsoleCtrlHandler(null, false); - - if (!silent) - { - if(exited) - System.Console.WriteLine("Successfully sent ctrl+c to process with id: " + pidToKill + "."); - else - System.Console.WriteLine("Process with id: " + pidToKill + " did not exit after 30 seconds, killed."); - } - } - else - { - if (!silent) - { - string errorMsg = new System.ComponentModel.Win32Exception(Marshal.GetLastWin32Error()).Message; - System.Console.WriteLine("Error attaching to pid: " + pidToKill + ": " + Marshal.GetLastWin32Error() + " - " + errorMsg); - } - } - } - } - } -"@ - # cygwin assumes environment variables are case sensitive which causes problems when - # the type dictionary references 'tmp' or 'temp' and throws a System.ArgumentException - $oldTmp = $env:TMP - $oldTemp = $env:Temp - $env:TMP='' - $env:TEMP='' - Add-Type -TypeDefinition $t - $env:TMP = $oldTmp - $env:TEMP = $oldTemp - - $pidToKill = Get-Content $p - # If run in cygwin, we don't get the TITLE / pid combo in stop-server.bat but also don't need - # to worry about reattaching console output as it gets stderr/stdout even after the C#/C++ - # FreeConsole calls. - if ($batchpid -eq "No") - { - $batchpid = -1 - } - - if ($f) - { - taskkill /f /pid $pidToKill - } - else - { - [PowerStopper.Stopper]::StopProgram($pidToKill, $batchpid, $silent) - } -} - -#----------------------------------------------------------------------------- -ValidateArguments -KillProcess diff --git a/build.xml b/build.xml index 436dffc..4ae126c 100644 --- a/build.xml +++ b/build.xml @@ -1204,9 +1204,9 @@ <target name="_artifacts-init" depends="jar,javadoc,gen-doc"> <mkdir dir="${dist.dir}"/> <!-- fix the control linefeed so that builds on windows works on linux --> - <fixcrlf srcdir="bin" includes="**/*" excludes="**/*.bat, **/*.ps1" eol="lf" eof="remove" /> - <fixcrlf srcdir="conf" includes="**/*" excludes="**/*.bat, **/*.ps1" eol="lf" eof="remove" /> - <fixcrlf srcdir="tools/bin" includes="**/*" excludes="**/*.bat, **/*.ps1" eol="lf" eof="remove" /> + <fixcrlf srcdir="bin" includes="**/*" eol="lf" eof="remove" /> + <fixcrlf srcdir="conf" includes="**/*" eol="lf" eof="remove" /> + <fixcrlf srcdir="tools/bin" includes="**/*" eol="lf" eof="remove" /> <copy todir="${dist.dir}/lib"> <fileset dir="${build.lib}"/> <fileset dir="${build.dir}"> @@ -1307,21 +1307,17 @@ <exclude name=".externalToolBuilders/**" /> </tarfileset> - <!-- Shell includes and batch files in bin/ and tools/bin/ --> + <!-- Shell includes in bin/ and tools/bin/ --> <tarfileset dir="${basedir}" prefix="${final.name}-src"> <include name="bin/*.in.sh" /> - <include name="bin/*.bat" /> <include name="tools/bin/*.in.sh" /> - <include name="tools/bin/*.bat" /> </tarfileset> <!-- Everything else (assumed to be scripts), is executable --> <tarfileset dir="${basedir}" prefix="${final.name}-src" mode="755"> <include name="bin/*"/> <exclude name="bin/*.in.sh" /> - <exclude name="bin/*.bat" /> <include name="tools/bin/*"/> <exclude name="tools/bin/*.in.sh" /> - <exclude name="tools/bin/*.bat" /> </tarfileset> </tar> diff --git a/conf/cassandra-env.ps1 b/conf/cassandra-env.ps1 deleted file mode 100644 index 8ba8a5a..0000000 --- a/conf/cassandra-env.ps1 +++ /dev/null @@ -1,469 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# NOTE: All param tuning can be done in the SetCassandraEnvironment Function below - -#----------------------------------------------------------------------------- -Function SetCassandraHome() -{ - if (! $env:CASSANDRA_HOME) - { - $cwd = [System.IO.Directory]::GetCurrentDirectory() - $cwd = Split-Path $cwd -parent - $env:CASSANDRA_HOME = $cwd -replace "\\", "/" - } -} - -#----------------------------------------------------------------------------- -Function SetCassandraMain() -{ - if (! $env:CASSANDRA_MAIN) - { - $env:CASSANDRA_MAIN="org.apache.cassandra.service.CassandraDaemon" - } -} - -#----------------------------------------------------------------------------- -Function BuildClassPath -{ - $cp = """$env:CASSANDRA_HOME\conf""" - foreach ($file in Get-ChildItem "$env:CASSANDRA_HOME\lib\*.jar") - { - $file = $file -replace "\\", "/" - $cp = $cp + ";" + """$file""" - } - - # Add build/classes/main so it works in development - $cp = $cp + ";" + """$env:CASSANDRA_HOME\build\classes\main""" - $env:CLASSPATH=$cp -} - -#----------------------------------------------------------------------------- -Function CalculateHeapSizes -{ - # Check if swapping is enabled on the host and warn if so - reference CASSANDRA-7316 - - $osInfo = Get-WmiObject -class "Win32_computersystem" - $autoPage = $osInfo.AutomaticManagedPageFile - - if ($autoPage) - { - echo "*---------------------------------------------------------------------*" - echo "*---------------------------------------------------------------------*" - echo "" - echo " WARNING! Automatic page file configuration detected." - echo " It is recommended that you disable swap when running Cassandra" - echo " for performance and stability reasons." - echo "" - echo "*---------------------------------------------------------------------*" - echo "*---------------------------------------------------------------------*" - } - else - { - $pageFileInfo = Get-WmiObject -class "Win32_PageFileSetting" -EnableAllPrivileges - $pageFileCount = $PageFileInfo.Count - if ($pageFileInfo) - { - $files = @() - $sizes = @() - $hasSizes = $FALSE - - # PageFileCount isn't populated and obj comes back as single if there's only 1 - if ([string]::IsNullOrEmpty($PageFileCount)) - { - $PageFileCount = 1 - $files += $PageFileInfo.Name - if ($PageFileInfo.MaximumSize -ne 0) - { - $hasSizes = $TRUE - $sizes += $PageFileInfo.MaximumSize - } - } - else - { - for ($i = 0; $i -le $PageFileCount; $i++) - { - $files += $PageFileInfo[$i].Name - if ($PageFileInfo[$i].MaximumSize -ne 0) - { - $hasSizes = $TRUE - $sizes += $PageFileInfo[$i].MaximumSize - } - } - } - - echo "*---------------------------------------------------------------------*" - echo "*---------------------------------------------------------------------*" - echo "" - echo " WARNING! $PageFileCount swap file(s) detected" - for ($i = 0; $i -lt $PageFileCount; $i++) - { - $toPrint = " Name: " + $files[$i] - if ($hasSizes) - { - $toPrint = $toPrint + " Size: " + $sizes[$i] - $toPrint = $toPrint -replace [Environment]::NewLine, "" - } - echo $toPrint - } - echo " It is recommended that you disable swap when running Cassandra" - echo " for performance and stability reasons." - echo "" - echo "*---------------------------------------------------------------------*" - echo "*---------------------------------------------------------------------*" - } - } - - # Validate that we need to run this function and that our config is good - if ($env:MAX_HEAP_SIZE -and $env:HEAP_NEWSIZE) - { - return - } - - if ((($env:MAX_HEAP_SIZE -and !$env:HEAP_NEWSIZE) -or (!$env:MAX_HEAP_SIZE -and $env:HEAP_NEWSIZE)) -and ($using_cms -eq $true)) - { - echo "Please set or unset MAX_HEAP_SIZE and HEAP_NEWSIZE in pairs. Aborting startup." - exit 1 - } - - $memObject = Get-WMIObject -class win32_physicalmemory - if ($memObject -eq $null) - { - echo "WARNING! Could not determine system memory. Defaulting to 2G heap, 512M newgen. Manually override in conf\jvm.options for different heap values." - $env:MAX_HEAP_SIZE = "2048M" - $env:HEAP_NEWSIZE = "512M" - return - } - - $memory = ($memObject | Measure-Object Capacity -Sum).sum - $memoryMB = [Math]::Truncate($memory / (1024*1024)) - - $cpu = gwmi Win32_ComputerSystem | Select-Object NumberOfLogicalProcessors - $systemCores = $cpu.NumberOfLogicalProcessors - - # set max heap size based on the following - # max(min(1/2 ram, 1024MB), min(1/4 ram, 8GB)) - # calculate 1/2 ram and cap to 1024MB - # calculate 1/4 ram and cap to 8192MB - # pick the max - $halfMem = [Math]::Truncate($memoryMB / 2) - $quarterMem = [Math]::Truncate($halfMem / 2) - - if ($halfMem -gt 1024) - { - $halfMem = 1024 - } - if ($quarterMem -gt 8192) - { - $quarterMem = 8192 - } - - $maxHeapMB = "" - if ($halfMem -gt $quarterMem) - { - $maxHeapMB = $halfMem - } - else - { - $maxHeapMB = $quarterMem - } - $env:MAX_HEAP_SIZE = [System.Convert]::ToString($maxHeapMB) + "M" - - # Young gen: min(max_sensible_per_modern_cpu_core * num_cores, 1/4 - $maxYGPerCore = 100 - $maxYGTotal = $maxYGPerCore * $systemCores - $desiredYG = [Math]::Truncate($maxHeapMB / 4) - - if ($desiredYG -gt $maxYGTotal) - { - $env:HEAP_NEWSIZE = [System.Convert]::ToString($maxYGTotal) + "M" - } - else - { - $env:HEAP_NEWSIZE = [System.Convert]::ToString($desiredYG) + "M" - } -} - -#----------------------------------------------------------------------------- -Function ParseJVMInfo -{ - # grab info about the JVM - $pinfo = New-Object System.Diagnostics.ProcessStartInfo - $pinfo.FileName = "$env:JAVA_BIN" - $pinfo.RedirectStandardError = $true - $pinfo.RedirectStandardOutput = $true - $pinfo.UseShellExecute = $false - $pinfo.Arguments = "-d64 -version" - $p = New-Object System.Diagnostics.Process - $p.StartInfo = $pinfo - $p.Start() | Out-Null - $p.WaitForExit() - $stderr = $p.StandardError.ReadToEnd() - - $env:JVM_ARCH = "64-bit" - - if ($stderr.Contains("Error")) - { - # 32-bit JVM. re-run w/out -d64 - echo "Failed 64-bit check. Re-running to get version from 32-bit" - $pinfo.Arguments = "-version" - $p = New-Object System.Diagnostics.Process - $p.StartInfo = $pinfo - $p.Start() | Out-Null - $p.WaitForExit() - $stderr = $p.StandardError.ReadToEnd() - $env:JVM_ARCH = "32-bit" - } - - $sa = $stderr.Split("""") - $env:JVM_VERSION = $sa[1] - - if ($stderr.Contains("OpenJDK")) - { - $env:JVM_VENDOR = "OpenJDK" - } - elseif ($stderr.Contains("Java(TM)")) - { - $env:JVM_VENDOR = "Oracle" - } - else - { - $JVM_VENDOR = "other" - } - - $pa = $sa[1].Split("_") - $subVersion = $pa[1] - # Deal with -b (build) versions - if ($subVersion -contains '-') - { - $patchAndBuild = $subVersion.Split("-") - $subVersion = $patchAndBuild[0] - } - $env:JVM_PATCH_VERSION = $subVersion -} - -#----------------------------------------------------------------------------- -Function SetCassandraEnvironment -{ - if (Test-Path Env:\JAVA_HOME) - { - $env:JAVA_BIN = "$env:JAVA_HOME\bin\java.exe" - } - elseif (Get-Command "java.exe") - { - $env:JAVA_BIN = "java.exe" - } - else - { - echo "ERROR! No JAVA_HOME set and could not find java.exe in the path." - exit - } - SetCassandraHome - $env:CASSANDRA_CONF = "$env:CASSANDRA_HOME\conf" - $env:CASSANDRA_PARAMS="-Dcassandra -Dlogback.configurationFile=logback.xml" - - $logdir = "$env:CASSANDRA_HOME\logs" - $storagedir = "$env:CASSANDRA_HOME\data" - $env:CASSANDRA_PARAMS = $env:CASSANDRA_PARAMS + " -Dcassandra.logdir=""$logdir"" -Dcassandra.storagedir=""$storagedir""" - - SetCassandraMain - BuildClassPath - - # Override these to set the amount of memory to allocate to the JVM at - # start-up. For production use you may wish to adjust this for your - # environment. MAX_HEAP_SIZE is the total amount of memory dedicated - # to the Java heap. HEAP_NEWSIZE refers to the size of the young - # generation. Both MAX_HEAP_SIZE and HEAP_NEWSIZE should be either set - # or not (if you set one, set the other). - # - # The main trade-off for the young generation is that the larger it - # is, the longer GC pause times will be. The shorter it is, the more - # expensive GC will be (usually). - # - # The example HEAP_NEWSIZE assumes a modern 8-core+ machine for decent - # times. If in doubt, and if you do not particularly want to tweak, go - # 100 MB per physical CPU core. - - #GC log path has to be defined here since it needs to find CASSANDRA_HOME - $env:JVM_OPTS="$env:JVM_OPTS -Xloggc:""$env:CASSANDRA_HOME/logs/gc.log""" - - # Read user-defined JVM options from jvm.options file - $content = Get-Content "$env:CASSANDRA_CONF\jvm.options" - for ($i = 0; $i -lt $content.Count; $i++) - { - $line = $content[$i] - if ($line.StartsWith("-")) - { - $env:JVM_OPTS = "$env:JVM_OPTS $line" - } - } - - $defined_xmn = $env:JVM_OPTS -like '*Xmn*' - $defined_xmx = $env:JVM_OPTS -like '*Xmx*' - $defined_xms = $env:JVM_OPTS -like '*Xms*' - $using_cms = $env:JVM_OPTS -like '*UseConcMarkSweepGC*' - - #$env:MAX_HEAP_SIZE="4096M" - #$env:HEAP_NEWSIZE="800M" - CalculateHeapSizes - - ParseJVMInfo - - # We only set -Xms and -Xmx if they were not defined on jvm.options file - # If defined, both Xmx and Xms should be defined together. - if (($defined_xmx -eq $false) -and ($defined_xms -eq $false)) - { - $env:JVM_OPTS="$env:JVM_OPTS -Xms$env:MAX_HEAP_SIZE" - $env:JVM_OPTS="$env:JVM_OPTS -Xmx$env:MAX_HEAP_SIZE" - } - elseif (($defined_xmx -eq $false) -or ($defined_xms -eq $false)) - { - echo "Please set or unset -Xmx and -Xms flags in pairs on jvm.options file." - exit - } - - # We only set -Xmn flag if it was not defined in jvm.options file - # and if the CMS GC is being used - # If defined, both Xmn and Xmx should be defined together. - if (($defined_xmn -eq $true) -and ($defined_xmx -eq $false)) - { - echo "Please set or unset -Xmx and -Xmn flags in pairs on jvm.options file." - exit - } - elseif (($defined_xmn -eq $false) -and ($using_cms -eq $true)) - { - $env:JVM_OPTS="$env:JVM_OPTS -Xmn$env:HEAP_NEWSIZE" - } - - if (($env:JVM_ARCH -eq "64-Bit") -and ($using_cms -eq $true)) - { - $env:JVM_OPTS="$env:JVM_OPTS -XX:+UseCondCardMark" - } - - # Add sigar env - see Cassandra-7838 - $env:JVM_OPTS = "$env:JVM_OPTS -Djava.library.path=""$env:CASSANDRA_HOME\lib\sigar-bin""" - - # Confirm we're on high performance power plan, warn if not - # Change to $true to suppress this warning - $suppressPowerWarning = $false - if (!$suppressPowerWarning) - { - $currentProfile = powercfg /GETACTIVESCHEME - if (!$currentProfile.Contains("High performance")) - { - echo "*---------------------------------------------------------------------*" - echo "*---------------------------------------------------------------------*" - echo "" - echo " WARNING! Detected a power profile other than High Performance." - echo " Performance of this node will suffer." - echo " Modify conf\cassandra.env.ps1 to suppress this warning." - echo "" - echo "*---------------------------------------------------------------------*" - echo "*---------------------------------------------------------------------*" - } - } - - # provides hints to the JIT compiler - $env:JVM_OPTS = "$env:JVM_OPTS -XX:CompileCommandFile=""$env:CASSANDRA_CONF\hotspot_compiler""" - - # add the jamm javaagent - $env:JVM_OPTS = "$env:JVM_OPTS -javaagent:""$env:CASSANDRA_HOME\lib\jamm-0.3.2.jar""" - - # set jvm HeapDumpPath with CASSANDRA_HEAPDUMP_DIR - if ($env:CASSANDRA_HEAPDUMP_DIR) - { - $unixTimestamp = [int64](([datetime]::UtcNow)-(get-date "1/1/1970")).TotalSeconds - $env:JVM_OPTS="$env:JVM_OPTS -XX:HeapDumpPath=""$env:CASSANDRA_HEAPDUMP_DIR\cassandra-$unixTimestamp-pid$pid.hprof""" - } - - # stop the jvm on OutOfMemoryError as it can result in some data corruption - # uncomment the preferred option - # ExitOnOutOfMemoryError and CrashOnOutOfMemoryError require a JRE greater or equals to 1.7 update 101 or 1.8 update 92 - # $env:JVM_OPTS="$env:JVM_OPTS -XX:+ExitOnOutOfMemoryError" - # $env:JVM_OPTS="$env:JVM_OPTS -XX:+CrashOnOutOfMemoryError" - $env:JVM_OPTS="$env:JVM_OPTS -XX:OnOutOfMemoryError=""taskkill /F /PID %p""" - - # print an heap histogram on OutOfMemoryError - # $env:JVM_OPTS="$env:JVM_OPTS -Dcassandra.printHeapHistogramOnOutOfMemoryError=true" - - $env:JAVA_VERSION=11 - if ($env:JVM_VERSION.CompareTo("1.8.0") -eq -1 -or [convert]::ToInt32($env:JVM_PATCH_VERSION) -lt 151) - { - echo "Cassandra 4.0 requires either Java 8 (update 151 or newer) or Java 11 (or newer). Java $env:JVM_VERSION is not supported." - exit - } - - # Specifies the default port over which Cassandra will be available for - # JMX connections. - $JMX_PORT="7199" - - # store in env to check if it's avail in verification - $env:JMX_PORT=$JMX_PORT - - # Configure the following for JEMallocAllocator and if jemalloc is not available in the system - # library path. - # set LD_LIBRARY_PATH=<JEMALLOC_HOME>/lib/ - # $env:JVM_OPTS="$env:JVM_OPTS -Djava.library.path=<JEMALLOC_HOME>/lib/" - - # jmx: metrics and administration interface - # - # add this if you're having trouble connecting: - # $env:JVM_OPTS="$env:JVM_OPTS -Djava.rmi.server.hostname=<public name>" - # - # see - # https://blogs.oracle.com/jmxetc/entry/troubleshooting_connection_problems_in_jconsole - # for more on configuring JMX through firewalls, etc. (Short version: - # get it working with no firewall first.) - # - # Due to potential security exploits, Cassandra ships with JMX accessible - # *only* from localhost. To enable remote JMX connections, uncomment lines below - # with authentication and ssl enabled. See https://wiki.apache.org/cassandra/JmxSecurity - # - #$env:JVM_OPTS="$env:JVM_OPTS -Dcom.sun.management.jmxremote.port=$JMX_PORT" - #$env:JVM_OPTS="$env:JVM_OPTS -Dcom.sun.management.jmxremote.rmi.port=$JMX_PORT" - # - # JMX SSL options - #$env:JVM_OPTS="$env:JVM_OPTS -Dcom.sun.management.jmxremote.ssl=true" - #$env:JVM_OPTS="$env:JVM_OPTS -Dcom.sun.management.jmxremote.ssl.need.client.auth=true" - #$env:JVM_OPTS="$env:JVM_OPTS -Dcom.sun.management.jmxremote.ssl.enabled.protocols=<enabled-protocols>" - #$env:JVM_OPTS="$env:JVM_OPTS -Dcom.sun.management.jmxremote.ssl.enabled.cipher.suites=<enabled-cipher-suites>" - #$env:JVM_OPTS="$env:JVM_OPTS -Djavax.net.ssl.keyStore=C:/keystore" - #$env:JVM_OPTS="$env:JVM_OPTS -Djavax.net.ssl.keyStorePassword=<keystore-password>" - #$env:JVM_OPTS="$env:JVM_OPTS -Djavax.net.ssl.trustStore=C:/truststore" - #$env:JVM_OPTS="$env:JVM_OPTS -Djavax.net.ssl.trustStorePassword=<truststore-password>" - # - # JMX auth options - #$env:JVM_OPTS="$env:JVM_OPTS -Dcom.sun.management.jmxremote.authenticate=true" - ## Basic file based authn & authz - #$env:JVM_OPTS="$env:JVM_OPTS -Dcom.sun.management.jmxremote.password.file=C:/jmxremote.password" - #$env:JVM_OPTS="$env:JVM_OPTS -Dcom.sun.management.jmxremote.access.file=C:/jmxremote.access" - - ## Custom auth settings which can be used as alternatives to JMX's out of the box auth utilities. - ## JAAS login modules can be used for authentication by uncommenting these two properties. - ## Cassandra ships with a LoginModule implementation - org.apache.cassandra.auth.CassandraLoginModule - - ## which delegates to the IAuthenticator configured in cassandra.yaml - #$env:JVM_OPTS="$env:JVM_OPTS -Dcassandra.jmx.remote.login.config=CassandraLogin" - #$env:JVM_OPTS="$env:JVM_OPTS -Djava.security.auth.login.config=C:/cassandra-jaas.config" - - ## Cassandra also ships with a helper for delegating JMX authz calls to the configured IAuthorizer, - ## uncomment this to use it. Requires one of the two authentication options to be enabled - #$env:JVM_OPTS="$env:JVM_OPTS -Dcassandra.jmx.authorizer=org.apache.cassandra.auth.jmx.AuthorizationProxy" - - # Default JMX setup, bound to local loopback address only - $env:JVM_OPTS="$env:JVM_OPTS -Dcassandra.jmx.local.port=$JMX_PORT" - - $env:JVM_OPTS="$env:JVM_OPTS $env:JVM_EXTRA_OPTS" -} diff --git a/doc/source/operating/security.rst b/doc/source/operating/security.rst index c945949..e97baef 100644 --- a/doc/source/operating/security.rst +++ b/doc/source/operating/security.rst @@ -276,7 +276,7 @@ providers are available; the first based on standard JMX security and the second Cassandra's own auth subsystem. The default settings for Cassandra make JMX accessible only from localhost. To enable remote JMX connections, edit -``cassandra-env.sh`` (or ``cassandra-env.ps1`` on Windows) to change the ``LOCAL_JMX`` setting to ``no``. Under the +``cassandra-env.sh`` to change the ``LOCAL_JMX`` setting to ``no``. Under the standard configuration, when remote JMX connections are enabled, :ref:`standard JMX authentication <standard-jmx-auth>` is also switched on. @@ -412,7 +412,7 @@ JMX With SSL ~~~~~~~~~~~~ JMX SSL configuration is controlled by a number of system properties, some of which are optional. To turn on SSL, edit -the relevant lines in ``cassandra-env.sh`` (or ``cassandra-env.ps1`` on Windows) to uncomment and set the values of these +the relevant lines in ``cassandra-env.sh`` to uncomment and set the values of these properties as required: ``com.sun.management.jmxremote.ssl`` diff --git a/pylib/cqlshlib/test/run_cqlsh.py b/pylib/cqlshlib/test/run_cqlsh.py index 2d0931c..134bb38 100644 --- a/pylib/cqlshlib/test/run_cqlsh.py +++ b/pylib/cqlshlib/test/run_cqlsh.py @@ -277,8 +277,6 @@ class CqlshRunner(ProcRunner): win_force_colors=True, tty=True, **kwargs): if path is None: cqlsh_bin = 'cqlsh' - if is_win(): - cqlsh_bin = 'cqlsh.bat' path = normpath(join(basecase.cqlshdir, cqlsh_bin)) if host is None: host = basecase.TEST_HOST diff --git a/redhat/cassandra.spec b/redhat/cassandra.spec index cbc78aa..f0652c4 100644 --- a/redhat/cassandra.spec +++ b/redhat/cassandra.spec @@ -75,14 +75,10 @@ patch -p1 < debian/patches/cassandra_logdir_fix.diff # uncomment hints_directory path sed -i 's/^# hints_directory:/hints_directory:/' conf/cassandra.yaml -# remove batch, powershell, and other files not being installed -rm -f conf/*.ps1 -rm -f bin/*.bat +# remove other files not being installed rm -f bin/*.orig -rm -f bin/*.ps1 rm -f bin/cassandra.in.sh rm -f lib/sigar-bin/*winnt* # strip segfaults on dll.. -rm -f tools/bin/*.bat rm -f tools/bin/cassandra.in.sh # copy default configs diff --git a/tools/bin/auditlogviewer.bat b/tools/bin/auditlogviewer.bat deleted file mode 100644 index 3b6bd81..0000000 --- a/tools/bin/auditlogviewer.bat +++ /dev/null @@ -1,41 +0,0 @@ -@REM -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat - -if NOT DEFINED CASSANDRA_MAIN set CASSANDRA_MAIN=org.apache.cassandra.tools.AuditLogViewer -if NOT DEFINED JAVA_HOME goto :err - -REM ***** JAVA options ***** -set JAVA_OPTS=^ - -Dlogback.configurationFile=logback-tools.xml - -set TOOLS_PARAMS= - -"%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp %CASSANDRA_CLASSPATH% "%CASSANDRA_MAIN%" %* -goto finally - -:err -echo JAVA_HOME environment variable must be set! -pause - -:finally - -ENDLOCAL diff --git a/tools/bin/cassandra-stress.bat b/tools/bin/cassandra-stress.bat deleted file mode 100644 index 5c2ecfa..0000000 --- a/tools/bin/cassandra-stress.bat +++ /dev/null @@ -1,22 +0,0 @@ -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat -if NOT DEFINED STRESS_HOME set STRESS_HOME=%CD%\.. -"%JAVA_HOME%\bin\java" %CASSANDRA_PARAMS% -cp %CASSANDRA_CLASSPATH% org.apache.cassandra.stress.Stress %* diff --git a/tools/bin/cassandra.in.bat b/tools/bin/cassandra.in.bat deleted file mode 100644 index 4d395e8..0000000 --- a/tools/bin/cassandra.in.bat +++ /dev/null @@ -1,45 +0,0 @@ -@REM -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off -if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%CD%\..\.. -if NOT DEFINED CASSANDRA_CONF set CASSANDRA_CONF="%CASSANDRA_HOME%\conf" - -REM JAVA_HOME can optionally be set here -REM set JAVA_HOME="<directory>" - -REM ***** CLASSPATH library setting ***** - -REM Ensure that any user defined CLASSPATH variables are not used on startup -set CLASSPATH=%CASSANDRA_CONF% - -REM For each jar in the CASSANDRA_HOME lib directory call append to build the CLASSPATH variable. -for %%i in ("%CASSANDRA_HOME%\lib\*.jar") do call :append "%%i" -for %%i in ("%CASSANDRA_HOME%\tools\lib\*.jar") do call :append "%%i" -for %%i in ("%CASSANDRA_HOME%\build\*.jar") do call :append "%%i" -goto :okClasspath - -:append -set CLASSPATH=%CLASSPATH%;%1 -goto :eof - -:okClasspath - -REM Include the build\classes\main directory so it works in development -set CASSANDRA_CLASSPATH=%CLASSPATH%;%CASSANDRA_CONF%;"%CASSANDRA_HOME%\build\classes\main";"%CASSANDRA_HOME%\build\classes\stress";"%CASSANDRA_HOME%\build\classes\fqltool" - -REM Add the default storage location. Can be overridden in conf\cassandra.yaml -set CASSANDRA_PARAMS=%CASSANDRA_PARAMS% "-Dcassandra.storagedir=%CASSANDRA_HOME%\data" diff --git a/tools/bin/fqltool.bat b/tools/bin/fqltool.bat deleted file mode 100644 index acb6d1c..0000000 --- a/tools/bin/fqltool.bat +++ /dev/null @@ -1,36 +0,0 @@ -@REM -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat - -if NOT DEFINED JAVA_HOME goto :err - -set CASSANDRA_PARAMS=%CASSANDRA_PARAMS% -Dcassandra.logdir="%CASSANDRA_HOME%\logs" - -"%JAVA_HOME%\bin\java" -cp %CASSANDRA_CLASSPATH% %CASSANDRA_PARAMS% -Dlog4j.configurationFile=log4j2-tools.xml org.apache.cassandra.fqltool.FullQueryLogTool %* -goto finally - -:err -echo The JAVA_HOME environment variable must be set to run this program! -pause - -:finally -ENDLOCAL & set RC=%ERRORLEVEL% -exit /B %RC% diff --git a/tools/bin/jmxtool.bat b/tools/bin/jmxtool.bat deleted file mode 100644 index a047ff2..0000000 --- a/tools/bin/jmxtool.bat +++ /dev/null @@ -1,36 +0,0 @@ -@REM -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat - -if NOT DEFINED JAVA_HOME goto :err - -set CASSANDRA_PARAMS=%CASSANDRA_PARAMS% -Dcassandra.logdir="%CASSANDRA_HOME%\logs" - -"%JAVA_HOME%\bin\java" -cp %CASSANDRA_CLASSPATH% %CASSANDRA_PARAMS% -Dlogback.configurationFile=logback-tools.xml org.apache.cassandra.tools.JMXTool %* -goto finally - -:err -echo The JAVA_HOME environment variable must be set to run this program! -pause - -:finally -ENDLOCAL & set RC=%ERRORLEVEL% -exit /B %RC% diff --git a/tools/bin/sstabledump.bat b/tools/bin/sstabledump.bat deleted file mode 100644 index 0a3a380..0000000 --- a/tools/bin/sstabledump.bat +++ /dev/null @@ -1,48 +0,0 @@ -@REM -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat - -if NOT DEFINED CASSANDRA_MAIN set CASSANDRA_MAIN=org.apache.cassandra.tools.SSTableExport -if NOT DEFINED JAVA_HOME goto :err - -REM ***** JAVA options ***** -set JAVA_OPTS=^ - -Dlogback.configurationFile=logback-tools.xml - -set TOOLS_PARAMS= -FOR %%A IN (%*) DO call :appendToolsParams %%A -goto runTool - -:appendToolsParams -set TOOLS_PARAMS=%TOOLS_PARAMS% %1 -goto :eof - -:runTool -"%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp %CASSANDRA_CLASSPATH% "%CASSANDRA_MAIN%" %TOOLS_PARAMS% -goto finally - -:err -echo JAVA_HOME environment variable must be set! -pause - -:finally - -ENDLOCAL diff --git a/tools/bin/sstableexpiredblockers.bat b/tools/bin/sstableexpiredblockers.bat deleted file mode 100644 index 7af1105..0000000 --- a/tools/bin/sstableexpiredblockers.bat +++ /dev/null @@ -1,23 +0,0 @@ -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off - -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat - -"%JAVA_HOME%\bin\java" -cp %CLASSPATH% org.apache.cassandra.tools.SSTableExpiredBlockers %* diff --git a/tools/bin/sstablelevelreset.bat b/tools/bin/sstablelevelreset.bat deleted file mode 100644 index b15cb48..0000000 --- a/tools/bin/sstablelevelreset.bat +++ /dev/null @@ -1,46 +0,0 @@ -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off - -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat - -if NOT DEFINED JAVA_HOME goto :err -set TOOL_MAIN=org.apache.cassandra.tools.SSTableLevelResetter - -REM ***** JAVA options ***** -set JAVA_OPTS=^ - -Dlogback.configurationFile=logback-tools.xml - -"%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp %CLASSPATH% %TOOL_MAIN% %* -goto finally - -:err -echo JAVA_HOME environment variable must be set! -set ERRORLEVEL=1 -pause - -:finally -ENDLOCAL & set RC=%ERRORLEVEL% -goto :exit_with_code - -:returncode -exit /B %RC% - -:exit_with_code -call :returncode %RC% \ No newline at end of file diff --git a/tools/bin/sstablemetadata.bat b/tools/bin/sstablemetadata.bat deleted file mode 100644 index 3cb6308..0000000 --- a/tools/bin/sstablemetadata.bat +++ /dev/null @@ -1,23 +0,0 @@ -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off - -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat - -"%JAVA_HOME%\bin\java" -cp %CLASSPATH% org.apache.cassandra.tools.SSTableMetadataViewer %* diff --git a/tools/bin/sstableofflinerelevel.bat b/tools/bin/sstableofflinerelevel.bat deleted file mode 100644 index 3372bba..0000000 --- a/tools/bin/sstableofflinerelevel.bat +++ /dev/null @@ -1,49 +0,0 @@ -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off - -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat - -if NOT DEFINED JAVA_HOME goto :err -if NOT DEFINED MAX_HEAP_SIZE set MAX_HEAP_SIZE="256M" -set TOOL_MAIN=org.apache.cassandra.tools.SSTableOfflineRelevel - -REM ***** JAVA options ***** -set JAVA_OPTS=^ - -ea ^ - -Xmx%MAX_HEAP_SIZE% ^ - -Dlogback.configurationFile=logback-tools.xml - -"%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp %CLASSPATH% %TOOL_MAIN% %* -goto finally - -:err -echo JAVA_HOME environment variable must be set! -set ERRORLEVEL=1 -pause - -:finally -ENDLOCAL & set RC=%ERRORLEVEL% -goto :exit_with_code - -:returncode -exit /B %RC% - -:exit_with_code -call :returncode %RC% \ No newline at end of file diff --git a/tools/bin/sstablerepairedset.bat b/tools/bin/sstablerepairedset.bat deleted file mode 100644 index f7a4eb8..0000000 --- a/tools/bin/sstablerepairedset.bat +++ /dev/null @@ -1,46 +0,0 @@ -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off - -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat - -if NOT DEFINED JAVA_HOME goto :err -set TOOL_MAIN=org.apache.cassandra.tools.SSTableRepairedAtSetter - -REM ***** JAVA options ***** -set JAVA_OPTS=^ - -Dlogback.configurationFile=logback-tools.xml - -"%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp %CLASSPATH% %TOOL_MAIN% %* -goto finally - -:err -echo JAVA_HOME environment variable must be set! -set ERRORLEVEL=1 -pause - -:finally -ENDLOCAL & set RC=%ERRORLEVEL% -goto :exit_with_code - -:returncode -exit /B %RC% - -:exit_with_code -call :returncode %RC% \ No newline at end of file diff --git a/tools/bin/sstablesplit.bat b/tools/bin/sstablesplit.bat deleted file mode 100644 index 2abed84..0000000 --- a/tools/bin/sstablesplit.bat +++ /dev/null @@ -1,41 +0,0 @@ -@REM -@REM Licensed to the Apache Software Foundation (ASF) under one or more -@REM contributor license agreements. See the NOTICE file distributed with -@REM this work for additional information regarding copyright ownership. -@REM The ASF licenses this file to You under the Apache License, Version 2.0 -@REM (the "License"); you may not use this file except in compliance with -@REM the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, software -@REM distributed under the License is distributed on an "AS IS" BASIS, -@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@REM See the License for the specific language governing permissions and -@REM limitations under the License. - -@echo off -if "%OS%" == "Windows_NT" setlocal - -pushd "%~dp0" -call cassandra.in.bat - -if NOT DEFINED CASSANDRA_MAIN set CASSANDRA_MAIN=org.apache.cassandra.tools.StandaloneSplitter -if NOT DEFINED JAVA_HOME goto :err - -REM ***** JAVA options ***** -set JAVA_OPTS=^ - -Dlogback.configurationFile=logback-tools.xml - -set TOOLS_PARAMS= - -"%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp %CASSANDRA_CLASSPATH% "%CASSANDRA_MAIN%" %* -goto finally - -:err -echo JAVA_HOME environment variable must be set! -pause - -:finally - -ENDLOCAL --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org