segunda-feira, maio 28, 2018

Enable SSL SOLR

Create a certificate with keytool:
Open CMD:
"%java_home%\bin\keytool" -genkeypair -alias solr-ssl -keyalg RSA -keysize 2048 -keypass mysecret -storepass mysecret -validity 9999 -keystore solr-ssl.keystore.jks -ext SAN=DNS:localhost,IP:172.31.87.2,IP:127.0.0.1 -dname "CN=localhost, OU=MaykonCorp, O=Maykon, L=Florianopolis, ST=SC, C=BR"

Convert JKS to PKCS12 :

"%java_home%\bin\keytool" -importkeystore -srckeystore solr-ssl.keystore.jks -destkeystore solr-ssl.keystore.p12 -srcstoretype jks -deststoretype pkcs12

Double click on the solr-ssl.keystore.p12 file and import to local machine.
Type password add place the certificate to Trusted Root Certification Authorities



Open solr.in.cmd:
Edit these lines:





I moved solr-ssl.keystore.p12 and solr-ssl.keystore.jks to C:\solr\server\etc

sexta-feira, maio 25, 2018

Install Solr Windows - Noob Edtion

Install Java JRE and check the version ( It must be the version 1.8 or later.):



Download Solr:
http://www.apache.org/dyn/closer.lua/lucene/solr/7.3.1



Set Java Home sysem variable:

setx -m JAVA_HOME "C:\Program Files (x86)\Java\jre1.8.0_171"

Extract solr.zip in C:\ for example, in my enviroment is C:\solr

Use NSSM to install Solr as a service:




Start the service and access http://localhost:8983





quinta-feira, maio 17, 2018

DISM

Display information about the image:
>Dism /Get-ImageInfo /ImageFile:C:\dism\install.wim

Mount an image:
>Dism /Mount-image /ImageFile:C:\dism\install.wim /index:2 /MountDir:C:\test

Display information about mounted image
>Dism /Get-MountedImageInfo

Unmount image and descart alterations
>Dism /Unmount-image /MountDir:c:\test /Discard

List of 3rd party drivers
>Dism /image:C:\test\ /Get-Drivers

Unmount image and descart alterations
>Dism /Unmount-image /MountDir:c:\test /Discard

Unmount image and commit the changes
>Dism /Unmount-Image /MountDir:C:\test\ /Commit

List all of the features avaliable
>Dism /Image:C:\test\ /Get-Features

Get information about feature
>Dism /Image:C:\test\ /Get-FeatureInfo /Featurename:DirectoryServices-DomainController

Enable Windows feature
>Dism /Image:C:\test\ /Enable-Feature /FeatureName:DirectoryServices-DomainController /All

domingo, maio 13, 2018

Install Nano Server - Quick Reference

Copy NanoServer folder from the installation media to your computer.
In my computer i copy to C:\NanoServer

Open PowerShell and go to the C:\NanoServer
Import the NanoServerImageGenerator module.

>Import-Module .\NanoServerImageGenerator -Verbose

Create a new image with the command:
>New-NanoServerImage -Edition Standard -DeploymentType Guest -MediaPath E:\ -BasePath .\ -TargetPath C:\Hyper-V\NanoSvr1\NanoSvr.vhdx -ComputerName NanoSvr1
-MediaPath = Media installation Windows Server 2016


Create a new VM and use an existent vhdx:
>new-vm -Name "NanoSRV01" -MemoryStartupBytes 1GB -VHDPath C:\Hyper-V\NanoSvr1\NanoSvr.vhdx -Generation 2

Now you can management your Nano Server!

sexta-feira, janeiro 26, 2018

Consulta SQL

Recentemente surgiu a necessidade de descobrir quais foram os registros alterados em uma base de dados. O que ocorreu é que após uma alteração em um determinado sistema o mesmo ficou indisponível, a maneira que eu encontrei foi alterar o registro na base de dados, para isso consultei os últimos registros alterados na base de dados, utilizei o comando abaixo:

SELECT OBJECT_NAME(OBJECT_ID) AS TableName, last_user_update FROM sys.dm_db_index_usage_stats WHERE database_id = DB_ID( 'DATABASE') order by last_user_update

Fonte: https://stackoverflow.com