Alachisoft NCache 4.1 - Online Documentation

CreateCache using PowerShell Script

This PowerShell script allows users to automate the process of creating local or clustered caches. This tool comes very handy for automating the deployment process in your QA, staging, and production environments. Internally it uses the CreateCache command line tool for cache creation. The only difference is that it can accept servers list (comma separated list) instead of single server for creating a clustered cache.
Please refer to the Troubleshooting Install script section if you have any issues in executing this script. You should find the UninstallNCache .ps1 script at the NCache installation path in the integration folder:
%INSTALLPATH%/NCache/Integration/PowerShell/ CreateCache.ps1
PS C:/Users>./CreateCache.ps1 cache-id /uid server-username /pwd server-password [option[...]]
Specifies an ID of the cache to be registered on a server.
Specify a valid user name that has permissions to execute the command on remote machine.
Specify a valid password.
/s server-name
Specify one or more cache server names in comma separated format and make sure the service is running on all of these machines. Default is local machine.
Example /s Server1, Server2, Server3.
/p port
Specifies the port if the server channel is not using the default port. The default is 8251 for http and 8250 for tcp channels.
/size cache-size
Specify cache memory size in terms MBs which is the amount of data the cache can store. Default value is 250MB
/e eviction-policy
Specifies the eviction policy for cache items. Cached items will be cleaned from the cache according to the specified policy if the cache reaches its limit. Possible values are: Priority, LFU, LRU (default).
/ratio eviction-ratio
Specifies the eviction ratio (Percentage) for cache items. Cached items will be cleaned from the cache according to the specified ratio if the cache reaches its limit. Default value is 5 %.
/interval clean-interval
Specify an interval after which cache should start the cleaning process and then wait for the next interval. Default clean-interval is 15 seconds.
/topology topology-name
Specifies the topology in case of clustered cache. Possible values are: partitioned-replicas-server, mirror, replicated and partitioned.
Only in case of 'partition-replicas-server' being the topology, this specifies the replication strategy: async (default) or sync.
Specify an available or unique port for cluster communication. Default is 7800.
/d default-priority
Specifies the default priority in case priority based eviction policy is selected. Possible values are: high, above-normal, normal (default), below-normal and low.
Suppresses the display of logo banner.
Displays command syntax and options for the utility.
In the following examples we will create a Local Cache, Replicated Cache and Partitioned Replica cache on three machines Test1, Test2, and Test3 using the PowerShell script CreateCache.ps1. It is assumed that NCache is installed on the default path "C:/program files". You must have to provide valid admin user ID and password that has the permissions to execute commands on remote machine.
Example of Creating Local Cache
PS C:/Program Files/ncache/integration/PowerShell>./CreateCache.ps1 myLocalCache /s Test1 /uid administrator /pwd 123pwd
This will create a local-cache "myLocalCache" on server "Test1" with default configuration. Please replace the server "Test1" with your own server name and user id, password with the actual user credentials.
Example of Creating Partitioned Replica Cache
PS C:/Program Files/ncache/integration/PowerShell>./CreateCache.ps1 test_part_replica /s Test1, Test2, Test3 /e priority /r 5 /size 500 /t partitioned-replica /c 7870 /uid administrator /pwd 123pwd
This will create a partitioned-replica cache cluster "test_part_replica" of three nodes (Test1, Test2, and Test3) of Size 500MB, eviction-policy priority eviction-ratio 5 and cluster-port 7870 and configuration will be updated on all cache servers.
Example of Creating Replicated Cache
PS C:/Program Files/ncache/integration/PowerShell>./CreateCache.ps1 test_repl_cache /s Test1, Test2 /e priority /r 5 /size 500 /t replicated /c 7880 /uid administrator /pwd 123pwd
This will create a replicated cache cluster " test_repl_cache" of two nodes (Test1 and Test2) and configuration will be updated on all cache servers.

Copyright © 2005-2012 Alachisoft. All rights reserved.