About Me

Love JAVA related technologies. Recently researching on Enterprise Integration (SOA and Messaging), Mobility and Big Data. I have working in JAVA related technologies as Software Architect, Enterprise Architect and Software Developer/Engineer for over 11 years. Currently, I am working as Senior Consultant of VMWare Inc.

Wednesday, June 15, 2016

Cloud Found CLI (cheat sheet)


GETTING STARTED:
   help                                   Show help
   version                                Print the version
   login                                  Log user in
   logout                                 Log user out
   passwd                                 Change user password
   target                                 Set or view the targeted org or space

   api                                    Set or view target api url
   auth                                   Authenticate user non-interactively

APPS:
   apps                                   List all apps in the target space
   app                                    Display health and status for app

   push                                   Push a new app or sync changes to an existing app
   scale                                  Change or view the instance count, disk space limit, and memory limit for an app
   delete                                 Delete an app
   rename                                 Rename an app

   start                                  Start an app
   stop                                   Stop an app
   restart                                Restart an app
   restage                                Restage an app
   restart-app-instance                   Terminate the running application Instance at the given index and instantiate a new instance of the application with the same index

   events                                 Show recent app events
   files                                  Print out a list of files in a directory or the contents of a specific file of an app running on the DEA backend
   logs                                   Tail or show recent logs for an app

   env                                    Show all env variables for an app
   set-env                                Set an env variable for an app
   unset-env                              Remove an env variable

   stacks                                 List all stacks (a stack is a pre-built file system, including an operating system, that can run apps)
   stack                                  Show information for a stack (a stack is a pre-built file system, including an operating system, that can run apps)

   copy-source                            Make a copy of app source code from one application to another.  Unless overridden, the copy-source command will restart the application.

   create-app-manifest                    Create an app manifest for an app that has been pushed successfully

   get-health-check                       Get the health_check_type value of an app
   set-health-check                       Set health_check_type flag to either 'port' or 'none'
   enable-ssh                             Enable ssh for the application
   disable-ssh                            Disable ssh for the application
   ssh-enabled                            Reports whether SSH is enabled on an application container instance
   ssh                                    SSH to an application container instance

SERVICES:
   marketplace                            List available offerings in the marketplace
   services                               List all service instances in the target space
   service                                Show service instance info

   create-service                         Create a service instance
   update-service                         Update a service instance
   delete-service                         Delete a service instance
   rename-service                         Rename a service instance

   create-service-key                     Create key for a service instance
   service-keys                           List keys for a service instance
   service-key                            Show service key info
   delete-service-key                     Delete a service key

   bind-service                           Bind a service instance to an app
   unbind-service                         Unbind a service instance from an app

   bind-route-service                     Bind a service instance to an HTTP route
   unbind-route-service                   Unbind a service instance from an HTTP route

   create-user-provided-service           Make a user-provided service instance available to CF apps
   update-user-provided-service           Update user-provided service instance

ORGS:
   orgs                                   List all orgs
   org                                    Show org info

   create-org                             Create an org
   delete-org                             Delete an org
   rename-org                             Rename an org

SPACES:
   spaces                                 List all spaces in an org
   space                                  Show space info

   create-space                           Create a space
   delete-space                           Delete a space
   rename-space                           Rename a space

   allow-space-ssh                        Allow SSH access for the space
   disallow-space-ssh                     Disallow SSH access for the space
   space-ssh-allowed                      Reports whether SSH is allowed in a space

DOMAINS:
   domains                                List domains in the target org
   create-domain                          Create a domain in an org for later use
   delete-domain                          Delete a domain
   create-shared-domain                   Create a domain that can be used by all orgs (admin-only)
   delete-shared-domain                   Delete a shared domain

   router-groups                          List router groups

ROUTES:
   routes                                 List all routes in the current space or the current organization
   create-route                           Create a url route in a space for later use
   check-route                            Perform a simple check to determine whether a route currently exists or not
   map-route                              Add a url route to an app
   unmap-route                            Remove a url route from an app
   delete-route                           Delete a route
   delete-orphaned-routes                 Delete all orphaned routes (i.e. those that are not mapped to an app)

BUILDPACKS:
   buildpacks                             List all buildpacks
   create-buildpack                       Create a buildpack
   update-buildpack                       Update a buildpack
   rename-buildpack                       Rename a buildpack
   delete-buildpack                       Delete a buildpack

USER ADMIN:
   create-user                            Create a new user
   delete-user                            Delete a user

   org-users                              Show org users by role
   set-org-role                           Assign an org role to a user
   unset-org-role                         Remove an org role from a user

   space-users                            Show space users by role
   set-space-role                         Assign a space role to a user
   unset-space-role                       Remove a space role from a user

ORG ADMIN:
   quotas                                 List available usage quotas
   quota                                  Show quota info
   set-quota                              Assign a quota to an org

   create-quota                           Define a new resource quota
   delete-quota                           Delete a quota
   update-quota                           Update an existing resource quota

   share-private-domain                   Share a private domain with an org
   unshare-private-domain                 Unshare a private domain with an org

SPACE ADMIN:
   space-quotas                           List available space resource quotas
   space-quota                            Show space quota info
   create-space-quota                     Define a new space resource quota
   update-space-quota                     Update an existing space quota
   delete-space-quota                     Delete a space quota definition and unassign the space quota from all spaces
   set-space-quota                        Assign a space quota definition to a space
   unset-space-quota                      Unassign a quota from a space

SERVICE ADMIN:
   service-auth-tokens                    List service auth tokens
   create-service-auth-token              Create a service auth token
   update-service-auth-token              Update a service auth token
   delete-service-auth-token              Delete a service auth token

   service-brokers                        List service brokers
   create-service-broker                  Create a service broker
   update-service-broker                  Update a service broker
   delete-service-broker                  Delete a service broker
   rename-service-broker                  Rename a service broker

   migrate-service-instances              Migrate service instances from one service plan to another
   purge-service-offering                 Recursively remove a service and child objects from Cloud Foundry database without making requests to a service broker
   purge-service-instance                 Recursively remove a service instance and child objects from Cloud Foundry database without making requests to a service broker

   service-access                         List service access settings
   enable-service-access                  Enable access to a service or service plan for one or all orgs
   disable-service-access                 Disable access to a service or service plan for one or all orgs

SECURITY GROUP:
   security-group                         Show a single security group
   security-groups                        List all security groups
   create-security-group                  Create a security group
   update-security-group                  Update a security group
   delete-security-group                  Deletes a security group
   bind-security-group                    Bind a security group to a space
   unbind-security-group                  Unbind a security group from a space

   bind-staging-security-group            Bind a security group to the list of security groups to be used for staging applications
   staging-security-groups                List security groups in the staging set for applications
   unbind-staging-security-group          Unbind a security group from the set of security groups for staging applications

   bind-running-security-group            Bind a security group to the list of security groups to be used for running applications
   running-security-groups                List security groups in the set of security groups for running applications
   unbind-running-security-group          Unbind a security group from the set of security groups for running applications

ENVIRONMENT VARIABLE GROUPS:
   running-environment-variable-group     Retrieve the contents of the running environment variable group
   staging-environment-variable-group     Retrieve the contents of the staging environment variable group
   set-staging-environment-variable-group Pass parameters as JSON to create a staging environment variable group
   set-running-environment-variable-group Pass parameters as JSON to create a running environment variable group

FEATURE FLAGS:
   feature-flags                          Retrieve list of feature flags with status of each flag-able feature
   feature-flag                           Retrieve an individual feature flag with status
   enable-feature-flag                    Enable the use of a feature so that users have access to and can use the feature
   disable-feature-flag                   Disable the use of a feature so that users have access to and can use the feature

ADVANCED:
   curl                                   Executes a request to the targeted API endpoint
   config                                 Write default values to the config
   oauth-token                            Retrieve and display the OAuth token for the current session
   ssh-code                               Get a one time password for ssh clients

ADD/REMOVE PLUGIN REPOSITORY:
   add-plugin-repo                        Add a new plugin repository
   remove-plugin-repo                     Remove a plugin repository
   list-plugin-repos                      List all the added plugin repositories
   repo-plugins                           List all available plugins in specified repository or in all added repositories

ADD/REMOVE PLUGIN:
   plugins                                List all available plugin commands
   install-plugin                         Install CLI plugin
   uninstall-plugin                       Uninstall the plugin defined in command argument

INSTALLED PLUGIN COMMANDS:
   dev                                    Control PCF Dev VMs running on your workstation

ENVIRONMENT VARIABLES:
   CF_COLOR=false                     Do not colorize output
   CF_HOME=path/to/dir/               Override path to default config directory
   CF_PLUGIN_HOME=path/to/dir/        Override path to default plugin config directory
   CF_STAGING_TIMEOUT=15              Max wait time for buildpack staging, in minutes
   CF_STARTUP_TIMEOUT=5               Max wait time for app instance startup, in minutes
   CF_TRACE=true                      Print API request diagnostics to stdout
   CF_TRACE=path/to/trace.log         Append API request diagnostics to a log file
   https_proxy=proxy.example.com:8080 Enable HTTP proxying for API requests

GLOBAL OPTIONS:
   --help, -h                         Show help
   -v                                 Print API request diagnostics to stdout

Wednesday, July 29, 2015

Gemfire 8.1 lessons learned

Pivotal Gemfire knowledge base https://support.pivotal.io/hc/en-us/categories/200072748-Pivotal-GemFire-Knowledge-Base Issue: On windows gfsh prompt doesn't return to user when execute "start locator" Solution: gfsh start locator --name=locator --dir=. --J=-Dgemfire.OSProcess.ENABLE_OUTPUT_REDIRECTION=true

Wednesday, March 20, 2013

GemFire tutorial (Embedded-API)

This tutorial demonstrates how to use embedded GemFire with Local Region. Region – logical grouping of data, it implements the java.util.Map, data are stored in key value pair Local Region– no peer to peer activity
    • Client region
      Data are hosted privately not visible to other cache member
  • There are only two files created for this Tutorial; FoodDish (Domain object), EmbeddedGemFireTest entry class pom.xml FoodDish EmbeddedGemFireTest

    Sunday, March 17, 2013

    Spring data JPA

    Spring Hibernate + JPA has been a popular combination of Java DAO layer. Hibernate claims it eases developer from writing SQL statement but arguably Hibernate adds other complications like HSQL and other annotation and entity class design such as Per-table and Per hierarchy tree. Spring Data really alleviates some of the pains ...

     Remember, one of my "non-technical" manager said "I like JAVA but it seems Application written in JAVA creates many files". At the time, the company was in process of switching from Coldfusion to JAVA. The manager has a valid point here. Look at example like this , <Customerdao>, Customerdaoimpl

    Spring Data really free you from writing CustomerDaoImpl and DAO is defined in "Repository". I really like the idea of Repository vs DAO even though they are not mutually exclusive. Do we really care as software developer/engineer where the data is being saved? To me I care less about where the data is being stored but rather I care much more about store the data now and have the data be available when I want to retrieve it. Data should not be restricted in Object format even we are dealing with JAVA. There may be times, I want to take a XML file and extract information from the XML file with XPATH or XSLT. With much being said. Let's have a simple example of using Spring Data JPA. I won't post the entity classes here but they are trivial. If you want them, feel free to ask. I'll email to you. My application context
    Repository
    Unit Test

    Tuesday, November 20, 2012

    Spring bean lifecycle

    1 Spring instantiates the bean.
    2 Spring injects values and bean references into the bean’s properties.
    3 If the bean implements BeanNameAware, Spring passes the bean’s ID to the set-
    BeanName() method.
    4 If the bean implements BeanFactoryAware, Spring calls the setBeanFactory()
    method, passing in the bean factory itself.
    5 If the bean implements ApplicationContextAware, Spring will call the set-
    ApplicationContext() method, passing in a reference to the enclosing application
    context.
    6 If any of the beans implement the BeanPostProcessor interface, Spring calls
    their postProcessBeforeInitialization() method.
    7 If any beans implement the InitializingBean interface, Spring calls their
    afterPropertiesSet() method. Similarly, if the bean was declared with an
    init-method, then the specified initialization method will be called.
    8 If there are any beans that implement BeanPostProcessor, Spring will call their
    postProcessAfterInitialization() method.
    9 At this point, the bean is ready to be used by the application and will remain in
    the application context until the application context is destroyed.
    10 If any beans implement the DisposableBean interface, then Spring will call
    their destroy() methods. Likewise, if any bean was declared with a destroymethod,
    then the specified method will be called.

    Wednesday, November 14, 2012

    Hadoop (setup fully-distributed/multiple nodes mode)

    Coming!

    Hadoop (setup in standalone)

     Pre-setup
    1) install Hadoop
    2) setup environment variable
    • JAVA_HOME
    • HADOOP_HOME
    standalone
    setup SSH for a Hadoop cluster

    1) Define a common account
    create a user level account with no Hadoop management privilegesAssume it is "hadoopUser"

    2) Generate SSH key pair
    execute this command and following the prompts for additional inputs "ssh-keygen -t rsa"
    the public keys are stored in location you have specified

    3) Distribute the public key to all nodes (master and slaves)
    scp <the location of your public key> hadoopUser@<hostname>:<new location>/master_key

    on the target host, execute the following commands
    $ mkdir ~/.ssh
    $ chmod 700 ~/.ssh
    $ mv ~/master_key ~/.ssh/authorized_keys
    $ chmod 600 ~/.ssh/authorized_keys

    4) Hadoop configuration
    cd $HADOOP_HOME
    In "hadoop-env.sh" add "export JAVA_HOME=/usr/share/jdk"

    5) the 3 main configuration files should be empty
    1. core-site.xml
    2. hdfs-site.xml
    3. mapred-site.xml
    Hadoop runs completely on local machine and it doesn't launch any of the Hadoop daemons.