mirror of https://github.com/apache/cassandra
Add "install" command to cassandra.bat
patch by Ben Coverston; reviewed by jbellis for CASSANDRA-292 git-svn-id: https://svn.apache.org/repos/asf/cassandra/trunk@1160429 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
477bb5f34b
commit
34e2ae59a9
|
|
@ -38,6 +38,8 @@
|
|||
* Stop reading from sstables once we know we have the most recent columns,
|
||||
for query-by-name requests (CASSANDRA-2498)
|
||||
* Add query-by-column mode to stress.java (CASSANDRA-3064)
|
||||
* Add "install" command to cassandra.bat (CASSANDRA-292)
|
||||
|
||||
|
||||
0.8.5
|
||||
* fix NPE when encryption_options is unspecified (CASSANDRA-3007)
|
||||
|
|
|
|||
|
|
@ -14,16 +14,18 @@
|
|||
@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"
|
||||
|
||||
pushd %~dp0..
|
||||
if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%CD%
|
||||
popd
|
||||
|
||||
if NOT DEFINED CASSANDRA_HOME set CASSANDRA_HOME=%~dp0..
|
||||
if NOT DEFINED CASSANDRA_MAIN set CASSANDRA_MAIN=org.apache.cassandra.thrift.CassandraDaemon
|
||||
if NOT DEFINED JAVA_HOME goto err
|
||||
|
||||
REM ***** JAVA options *****
|
||||
set JAVA_OPTS=^
|
||||
-ea^
|
||||
set JAVA_OPTS=-ea^
|
||||
-javaagent:"%CASSANDRA_HOME%\lib\jamm-0.2.2.jar"^
|
||||
-Xms1G^
|
||||
-Xmx1G^
|
||||
|
|
@ -58,13 +60,46 @@ goto :eof
|
|||
REM Include the build\classes\main directory so it works in development
|
||||
set CASSANDRA_CLASSPATH=%CLASSPATH%;"%CASSANDRA_HOME%\build\classes\main";"%CASSANDRA_HOME%\build\classes\thrift"
|
||||
set CASSANDRA_PARAMS=-Dcassandra -Dcassandra-foreground=yes
|
||||
if /i "%ARG%" == "INSTALL" goto installService
|
||||
goto runDaemon
|
||||
|
||||
|
||||
:runDaemon
|
||||
echo Starting Cassandra Server
|
||||
"%JAVA_HOME%\bin\java" %JAVA_OPTS% %CASSANDRA_PARAMS% -cp %CASSANDRA_CLASSPATH% "%CASSANDRA_MAIN%"
|
||||
goto finally
|
||||
|
||||
:installService
|
||||
set SERVICE_JVM="cassandra"
|
||||
rem location of Prunsrv
|
||||
set PATH_PRUNSRV=%CASSANDRA_HOME%\bin\daemon\
|
||||
set PR_LOGPATH=%PATH_PRUNSRV%
|
||||
|
||||
rem fix up java ops replace ' -' with ' ;-'
|
||||
set JAVA_OPTS_DELM=%JAVA_OPTS: -=;-%
|
||||
|
||||
rem Allow prunsrv to be overridden
|
||||
if "%PRUNSRV%" == "" set PRUNSRV=%PATH_PRUNSRV%prunsrv
|
||||
|
||||
rem Install the service
|
||||
echo trying to delete service if it has been created already
|
||||
%PRUNSRV% //DS//%SERVICE_JVM%
|
||||
echo Installing %SERVICE_JVM%
|
||||
%PRUNSRV% //IS//%SERVICE_JVM%
|
||||
|
||||
echo Setting the parameters for %SERVICE_JVM%
|
||||
rem set PR_CLASSPATH=%CASSANDRA_CLASSPATH%
|
||||
%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 ^
|
||||
++JvmOptions=%JAVA_OPTS_DELM% ++JvmOptions=-DCassandra ^
|
||||
--PidFile pid.txt
|
||||
|
||||
echo Installation of %SERVICE_JVM% is complete
|
||||
goto finally
|
||||
|
||||
:err
|
||||
echo JAVA_HOME environment variable must be set!
|
||||
pause
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ import org.apache.thrift.transport.TTransportFactory;
|
|||
|
||||
public class CassandraDaemon extends org.apache.cassandra.service.AbstractCassandraDaemon
|
||||
{
|
||||
protected static CassandraDaemon instance;
|
||||
private static Logger logger = LoggerFactory.getLogger(CassandraDaemon.class);
|
||||
private final static String SYNC = "sync";
|
||||
private final static String ASYNC = "async";
|
||||
|
|
@ -86,9 +87,16 @@ public class CassandraDaemon extends org.apache.cassandra.service.AbstractCassan
|
|||
}
|
||||
}
|
||||
|
||||
public static void stop(String[] args)
|
||||
{
|
||||
instance.stopServer();
|
||||
instance.deactivate();
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
new CassandraDaemon().activate();
|
||||
instance = new CassandraDaemon();
|
||||
instance.activate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue