11 Mart 2014 Salı
the file operations in Perl Script
sample perl program
open (DOSYAM, ">>./dosyam.dat") || die ("HATALI iSLEM..!");print DOSYAM "$FORM{'ad'}:$FORM{'email'}:$FORM{'not'}\n";
# yukarda bulunan : karakteri her alanı bir diğerinden ayırır.
# bu karakteri, alan ayıracı olarak kendimiz belirledik
close(DOSYAM);
9 Ocak 2014 Perşembe
ubuntu apache2 için ip adress bloklama
ilk olarak
apache config dosyasını açın apache2.conf
genelde (/etc/apache2/apache2.conf)
sudo vi /etc/apache2/apache2.conf
alt satıra kopyalayın (added)

:wq! ##kaydedip cıkın
dikkat edin arada boşlular olmasın... restart olurken hata labilirsiniz..
daha sonra
sudo /etc/init.d/apache2 restart
sonra
sudo service httpd restart
###bitti###
hepsi bu kadar.
belirtilen ip adreslerinden artık apache uygulamanıza bağlanamazlar
apache config dosyasını açın apache2.conf
genelde (/etc/apache2/apache2.conf)
sudo vi /etc/apache2/apache2.conf
alt satıra kopyalayın (added)
:wq! ##kaydedip cıkın
dikkat edin arada boşlular olmasın... restart olurken hata labilirsiniz..
daha sonra
sudo /etc/init.d/apache2 restart
sonra
sudo service httpd restart
###bitti###
hepsi bu kadar.
belirtilen ip adreslerinden artık apache uygulamanıza bağlanamazlar
Etiketler:
apache,
apache allow,
apache deny,
apache.conf,
apache2,
ubuntu
2 Ocak 2014 Perşembe
açık portaları listeleme ve port üzerinden PID öğrenme
lsof -i TCP|fgrep LISTEN | grep dataserve
ve
korn shell için şu şekilde bir script yazılabilir.
#!/bin/ksh
line='---------------------------------------------'
pids=$(/usr/bin/ps -ef | sed 1d | awk '{print $2}')
if [ $# -eq 0 ]; then
read ans?"Enter port you would like to know pid for: "
else
ans=$1
fi
for f in $pids
do
/usr/proc/bin/pfiles $f 2>/dev/null | /usr/xpg4/bin/grep -q "port: $ans"
if [ $? -eq 0 ]; then
echo $line
echo "Port: $ans is being used by PID:\c"
/usr/bin/ps -ef -o pid -o args | egrep -v "grep|pfiles" | grep $f
fi
done
exit 0
ve
korn shell için şu şekilde bir script yazılabilir.
#!/bin/ksh
line='---------------------------------------------'
pids=$(/usr/bin/ps -ef | sed 1d | awk '{print $2}')
if [ $# -eq 0 ]; then
read ans?"Enter port you would like to know pid for: "
else
ans=$1
fi
for f in $pids
do
/usr/proc/bin/pfiles $f 2>/dev/null | /usr/xpg4/bin/grep -q "port: $ans"
if [ $? -eq 0 ]; then
echo $line
echo "Port: $ans is being used by PID:\c"
/usr/bin/ps -ef -o pid -o args | egrep -v "grep|pfiles" | grep $f
fi
done
exit 0
diskten boot ederek çalıştırma
aşağıdaki komut ile kopyalama yapılırsa bilgisayar diskten boot ederek çalışır..
df -h ile sdb mi flash diskin ona bak
sudo dd if=ubuntu-12.10-desktop-amd64.iso of=/dev/sdb
df -h ile sdb mi flash diskin ona bak
sudo dd if=ubuntu-12.10-desktop-amd64.iso of=/dev/sdb
tcpdump ile broadcats yayın yapan sql sorgularının yakalanması
diğer database kullanıcıları için ilk olarak şu şekilde çalıştırılabilir
# tcpdump -i eth0 -s 0 -l -w - dst port 3306 | strings
>>>>>>mysql database için sorgu
# tcpdump -i eth0 -s 0 -l -w - dst port 3306 | strings | perl -e '
while(<>) { chomp; next if /^[^ ]+[ ]*$/;
if(/^(SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER)/i) {
if (defined $q) { print "$qn"; }
$q=$_;
} else {
$_ =~ s/^[ t]+//; $q.=" $_";
}
}'
Sybase rep server connection subscription definition
---- primary database de
sp_setreptable mytable,"true"
go
sp_addlogin PEKTAS_maint,PEKTAS_maint_ps
grant role sa_role to PEKTAS_maint
grant role replication_role to PEKTAS_maint
isql -Usa -SPEKTAS -DPEKTAS -i rs_install_primary.sql
--- rep server da
create connection to PEKTAS.PEKTAS
set error class to rs_sqlserver_error_class
set function string class to rs_sqlserver_function_class
set username to PEKTAS_maint
set password to ******
with log transfer on --- connection primary db ye ise olmalı.WS da ise iki tarafta da olmalı
create user rep_user_PEKTAS set password *******
go
grant connect source to rep_user_PEKTAS
go
create replication definition repdef_PEKTAS
with primary at PEKTAS.PEKTAS
with all tables named mytable(id int, a varchar(15) ,b varchar(15) )
primary key (id)
create connection to sPEKTAS.PEKTAS
set error class to rs_sqlserver_error_class
set function string class to rs_sqlserver_function_class
set username to PEKTAS_maint
set password to *****
with log transfer on
create subscription sub_PEKTAS
for repdef_PEKTAS
with replicate at sPEKTAS.PEKTAS
admin who_is_down
---prim database
sp_configure "enable rep agent threads",1
sp_config_rep_agent PEKTAS,enable,'PRS','rep_user_PEKTAS','*******'
------secondary database de
sp_addlogin PEKTAS_maint,******
go
sp_addalias "PEKTAS_maint","dbo"
go
sp_start_rep_agent PEKTAS
--------------------------****bittiiii********-------------
--subscription drop
drop subscription sub_name
for repdef_name
with replicate at ds.db
with purge --secondary tabloyu truncate eder
without purge --secondary ve primary tabloyu aynen birakir
--checking subscription
check subscription sub_name
for repdef_name
with replicate at ds.db
create connection to peliste.pdb
set error class to rs_sqlserver_error_class
set function string class to rs_sqlserver_function_class
set username to PEKTAS_maint
set password to *******
with log transfer on --- connection primary db ye ise olmalı.WS da ise iki tarafta da olmalı
GO
----AFET çalısma
create database replication definition DATABASEYONET_rep_def
with primary at DATABASEYONET.DATABASEYONET
replicate ddl
replicate system procedures
create connection to raporAFET.DATABASE_NAME
SET error class to rs_sqlserver_error_class
set function string class to rs_sqlserver_function_class
set username to DATABASE_NAME_maint
set password to *******
define subscription DATABASE_NAME_konya_sub
for database replication definition DATABASE_NAME_repdef
with primary at SERVERNAME.DATABASE_NAME
with replicate at raporAFET.DATABASE_NAME
use dump marker
sp_setreptable mytable,"true"
go
sp_addlogin PEKTAS_maint,PEKTAS_maint_ps
grant role sa_role to PEKTAS_maint
grant role replication_role to PEKTAS_maint
isql -Usa -SPEKTAS -DPEKTAS -i rs_install_primary.sql
--- rep server da
create connection to PEKTAS.PEKTAS
set error class to rs_sqlserver_error_class
set function string class to rs_sqlserver_function_class
set username to PEKTAS_maint
set password to ******
with log transfer on --- connection primary db ye ise olmalı.WS da ise iki tarafta da olmalı
create user rep_user_PEKTAS set password *******
go
grant connect source to rep_user_PEKTAS
go
create replication definition repdef_PEKTAS
with primary at PEKTAS.PEKTAS
with all tables named mytable(id int, a varchar(15) ,b varchar(15) )
primary key (id)
create connection to sPEKTAS.PEKTAS
set error class to rs_sqlserver_error_class
set function string class to rs_sqlserver_function_class
set username to PEKTAS_maint
set password to *****
with log transfer on
create subscription sub_PEKTAS
for repdef_PEKTAS
with replicate at sPEKTAS.PEKTAS
admin who_is_down
---prim database
sp_configure "enable rep agent threads",1
sp_config_rep_agent PEKTAS,enable,'PRS','rep_user_PEKTAS','*******'
------secondary database de
sp_addlogin PEKTAS_maint,******
go
sp_addalias "PEKTAS_maint","dbo"
go
sp_start_rep_agent PEKTAS
--------------------------****bittiiii********-------------
--subscription drop
drop subscription sub_name
for repdef_name
with replicate at ds.db
with purge --secondary tabloyu truncate eder
without purge --secondary ve primary tabloyu aynen birakir
--checking subscription
check subscription sub_name
for repdef_name
with replicate at ds.db
create connection to peliste.pdb
set error class to rs_sqlserver_error_class
set function string class to rs_sqlserver_function_class
set username to PEKTAS_maint
set password to *******
with log transfer on --- connection primary db ye ise olmalı.WS da ise iki tarafta da olmalı
GO
----AFET çalısma
create database replication definition DATABASEYONET_rep_def
with primary at DATABASEYONET.DATABASEYONET
replicate ddl
replicate system procedures
create connection to raporAFET.DATABASE_NAME
SET error class to rs_sqlserver_error_class
set function string class to rs_sqlserver_function_class
set username to DATABASE_NAME_maint
set password to *******
define subscription DATABASE_NAME_konya_sub
for database replication definition DATABASE_NAME_repdef
with primary at SERVERNAME.DATABASE_NAME
with replicate at raporAFET.DATABASE_NAME
use dump marker
Etiketler:
connection,
primary database,
replication server,
subscription,
sybase,
sybase definition,
sybase rep server
Sybase Rep server kurulumu
REPLİCATION SERVER
Regular Replication tablo bazında
Warm Standby database bazında (aktif,pasif)
MSA birden fazla database
Mirror Aktivator
Rep Server da kullanıcı ve şifreler cfg dosyasında mevcut
Rep server kurulduktan sonra geri kalan işlemleri rs_init ile rep server instance kurulur
ASE server kurulduktan sonra charset yapılır
charset -Usa -P -S turdict.srt iso88599
sp_configure "default sortorder_id",72,"iso88599" restart gerekiyor
*************************
REP SERVER KURULUMU
mkdir sybasers/PRS
mkdir sybasers/RRS
touch /sybasers/PRS/prs_part.dat
touch /sybasers/RRS/rrs_part.dat
/sybrep/data/pektas/rep_pektas.dat
cp ../sybase/interfaces .
create route
isql -Usa -P -SPRS
1> create route to RRS
2> set username to RRS_rsi
3> set password to RRS_rsi_ps
4> go
1> exit
isql -Usa -P -SRRS
1> create route to PRS
2> set username to PRS_rsi
3> set password to PRS_rsi_ps
4> go
sp_setreptable authors,true
sf 4.23 önemli
rs_helprep RSSD databasinde ile repdefleri görebiliriz
sf 5.35-38 önemli
-- prdb & rdb
create table test_table (id int, data_column char(30))
go
grant all on test_table to public
go
create replication definition test_table_repdef
with primary at PDS.pdb
with all tables named "test_table"
(id int, data_column char(30))
primary key(id)
go
create subscription test_table_sub
for test_table_repdef
with replicate at RDS.rdb
without materialization
go
check subscription test_table_sub
for test_table_repdef
with replicate at RDS.rdb
go
-- pdb
sp_setreptable test_table, true
go
insert into test_table values(1, "This is another test record")
go
select * from test_table
go
WARM STANDBY
sp_stop_rep_agent pdb
dbcc settrunc(ltm,ignore) ile veya sp_config_rep_agent 'databasename',disable truncation pointi kaldırır
sp_stop_rep_agent PRS_RSSD
dbcc settrunc(ltm,ignore)
sp_setreptable test_table,false tum tabloların marklarının işaretleri kaldırılır
tablolara ait repdef ve subcriptionlar silinir
2 taraftaki routeler silinir
sf 7.26 önemli
sf 8,7 önemli switch over adımları
admin logical_status ile replike olan database ve yerleri görülür
Kaydol:
Kayıtlar (Atom)
