Realm 데이터베이스
수십억 사용자들이 사용하고 있고 개발자들이 사랑하는 Realm 데이터베이스는 빠르고 사용하기 쉬우며 오픈소스입니다. 그리고 완전히 무료입니다.
Start Building Now
Pick you flavor of the Realm's offline-first database below and reach out on our forums if you have any questions.
class Dog {}
Dog.schema = {
name: 'Dog',
properties: {
name: 'string',
age: 'int',
}
};
let realm = new Realm({ schema: [Dog] });
realm.write(() => {
realm.create('Dog', {name: 'Rex', age: 1});
});
let pups = realm.objects('Dog').filtered('age < 2');
Dog *dog = [Dog new];
dog.name = @"Rex";
dog.age = 1;
RLMRealm *realm = [RLMRealm defaultRealm];
[realm transactionWithBlock:^{
[realm addObject:dog];
}];
RLMResults<Dog *> *allDogs = [Dog allObjects];
RLMResults<Dog *> *pups = [allDogs objectsWhere:@"age < 2"];
class Dog: Object {
@objc dynamic var name = ""
@objc dynamic var age = 0
}
let dog = Dog()
dog.name = "Rex"
dog.age = 1
let realm = try! Realm()
try! realm.write {
realm.add(dog)
}
let pups = realm.objects(Dog.self).filter("age < 2")
public class Dog extends RealmObject {
public String name;
public int age;
}
Dog dog = new Dog();
dog.name = "Rex";
dog.age = 1;
Realm realm = Realm.getDefaultInstance();
realm.beginTransaction();
realm.copyToRealm(dog);
realm.commitTransaction();
RealmResults<Dog> pups = realm.where(Dog.class)
.lessThan("age", 2)
.findAll();
public class Dog : RealmObject
{
public string Name { get; set; }
public int Age { get; set; }
}
var realm = Realm.GetInstance();
realm.Write(() =>
{
realm.Add(new Dog
{
Name = "Rex",
Age = 1
});
});
var pups = realm.All<Dog>().Where(d => d.Age < 2);
더 간결한 코드로 만들 수 있습니다 RealmObject를 subclass해서 스키마를 정의하고 RealmObject를 subclass해서 스키마를 정의하고 스키마를 정의하고 RealmObject를 subclass해서 스키마를 정의하고 RealmObject를 subclass해서 스키마를 정의하고 트랜젝션을 쉽게 관리하고 자연스러운 인터페이스를 NSPredicate를 간단한 문자열을 NSPredicate LINQ를 통해 쿼리 하세요. 데이터베이스를 사용하는 것은 이렇게 쉬워야 합니다.
RealmObject를 subclass해서 스키마를 정의하고 RealmObject를 subclass해서 스키마를 정의하고 스키마를 정의하고 RealmObject를 subclass해서 스키마를 정의하고 RealmObject를 subclass해서 스키마를 정의하고 트랜젝션을 쉽게 관리하고 자연스러운 인터페이스를 NSPredicate를 간단한 문자열을 NSPredicate LINQ를 통해 쿼리 하세요. 데이터베이스를 사용하는 것은 이렇게 쉬워야 합니다.
React Native executes JavaScript in a dedicated worker thread so common concurrency primitives are unavailable.
// Query and update the result in another thread
dispatch_async(dispatch_queue_create("background", 0), ^{
Dog *theDog = [[Dog objectsWhere:@"age == 1"] firstObject];
RLMRealm *realm = [RLMRealm defaultRealm];
[realm beginWriteTransaction];
theDog.age = 3;
[realm commitWriteTransaction];
});
// Query and update from any thread
DispatchQueue(label: "background").async {
let realm = try! Realm()
let theDog = realm.objects(Dog.self).filter("age == 1").first
try! realm.write {
theDog!.age = 3
}
}
public void onActivityCreated(Bundle savedInstanceState) {
realm = Realm.getDefaultInstance();
customers = realm.where(Customer.class).findAllAsync();
changeListener = new RealmChangeListener() {
@Override
public void onChange(RealmResults<Customer> results) {
listAdapter.notifyDataSetChanged(); // Update the UI
}
};
customers.addChangeListener(changeListener);
}
// Query and update from any thread
Task.Run(() =>
{
var realm = Realm.GetInstance();
var theDog = realm.All<Dog>().First(d => d.Age == 1);
realm.Write(() => theDog.Age = 3);
});
스레드 사이를 넘나들며 작업하세요 Realm에 새로운 레퍼런스를 만들면 새로운 스레드에서 그대로 사용할 수 있습니다. 각각의 스레드는 언제나 일관된 데이터를 보여주므로 상태가 언제나 업데이트된 상태로 유지됩니다.
Realm에 새로운 레퍼런스를 만들면 새로운 스레드에서 그대로 사용할 수 있습니다. 각각의 스레드는 언제나 일관된 데이터를 보여주므로 상태가 언제나 업데이트된 상태로 유지됩니다.
let key = new Int8Array(64); // pupulate with a secure key
let realm = new Realm({ schema: [Dog], encryptionKey: key });
let dogs = realm.objects('Dog').filtered('name CONTAINS "Fido"');
// Generate a random encryption key
NSMutableData *key = [NSMutableData dataWithLength:64];
(void)SecRandomCopyBytes(kSecRandomDefault, key.length, (uint8_t *)key.mutableBytes);
// Open the encrypted Realm file
RLMRealmConfiguration *config = [RLMRealmConfiguration defaultConfiguration];
config.encryptionKey = key;
RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];
// Use the Realm as normal
RLMResults<Dog *> *dogs = [Dog objectsInRealm:realm where:@"name contains 'Fido'"];
// Generate a random encryption key
var key = Data(count: 64)
_ = key.withUnsafeMutableBytes { bytes in
SecRandomCopyBytes(kSecRandomDefault, 64, bytes)
}
// Open the encrypted Realm file
let realm = try! Realm(configuration: Realm.Configuration(encryptionKey: key))
// Use the Realm as normal
let dogs = realm.objects(Dog.self).filter("name contains 'Fido'")
// Generate a random encryption key
byte[] key = new byte[64];
new SecureRandom().nextBytes(key);
// Open the encrypted Realm file
RealmConfiguration realmConfiguration = new RealmConfiguration.Builder()
.encryptionKey(key)
.build();
// Use the Realm as normal
Realm realm = Realm.getInstance(config);
RealmResults<Dog> results = realm.where(Dog.class).contains("name", "Fido").findAll();
// Generate a random encryption key
var random = new Random();
var key = new Byte[64];
rnd.NextBytes(key);
var config = new RealmConfiguration("Mine.realm");
config.EncryptionKey = key;
// Open the encrypted Realm file
var realm = Realm.GetInstance(config);
// Use the Realm as normal
var dogs = realm.All<Dog>().Where(d => d.Name.Contains("Fido"));
모든것을 암호화하세요 데이터를 AES-256로 암호화하세요. 금융권에서 사용할 정도로 안전합니다.
데이터를 AES-256로 암호화하세요. 금융권에서 사용할 정도로 안전합니다.
let realm = new Realm({ schema: [Person] });
realm.addListener((sender, name) => {
if (name === 'change') {
this.setState({ source: sender.objects('Dog') });
}
});
self.notificationToken = [[Dog objectsWhere:@"age > 5"]
addNotificationBlock:^(RLMResults<Dog *> *results,
RLMCollectionChange *change,
NSError *error) {
if (error) {
// handle error
return;
} else if (!changes) {
[self.tableView reloadData];
return;
}
// Update table view to animate deletions, insertions and modifications
[tableView beginUpdates];
[tableView deleteRowsAtIndexPaths:[changes deletionsInSection:0]
withRowAnimation:UITableViewRowAnimationAutomatic];
[tableView insertRowsAtIndexPaths:[changes insertionsInSection:0]
withRowAnimation:UITableViewRowAnimationAutomatic];
[tableView reloadRowsAtIndexPaths:[changes modificationsInSection:0]
withRowAnimation:UITableViewRowAnimationAutomatic];
[tableView endUpdates];
}];
let realm = try! Realm()
notificationToken = realm.objects(Dog.self).filter("age > 5").observe { changes in
switch changes {
case .initial:
tableView.reloadData()
break
case .update(_, let deletions, let insertions, let modifications):
// Update table view to animate deletions, insertions and modifications
break
case .error(let error):
// handle error
break
}
}
Realm realm = Realm.getDefaultInstance();
// Query in the background
RealmResults<Dog> results = realm.where(Dog.class)
.greaterThan("age", 5)
.findAllAsync();
// Use ChangeListeners to be notified about updates
results.addChangeListener(new RealmChangeListener<RealmResults<Dog>() {
@Override
public void onChange(RealmResults<Dog> results) {
// Update UI
}
});
// Or RxJava
Observable<RealmResults<Dog>> obs = results.asObservable();
// To bind a ListView to results of a query
public partial class DogsPage : ContentPage
{
internal Realm realm;
internal IEnumerable<Dog> Entries { get; }
public DogsPage()
{
InitializeComponent();
realm = Realm.GetInstance();
// Results from queries will automatically notify the Binding
// and update the ListView accordingly
Entries = realm.All<Dog>().Where(d => d.Age > 5)
DogsList.ItemsSource = Entries;
}
<ListView x:Name="DogsList">
<ListView.ItemTemplate>
<DataTemplate>
<TextCell Text="{Binding Name}"
Detail="{Binding Age, StringFormat='is {0:#}'}" />
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
리액티브 앱을 개발하세요 Realm 객체는 항상 라이브입니다. 즉 언제나 최신의 데이터를 유지하고 있습니다. 데이터가 수정되면 알림을 받아 UI를 업데이트 할 수 있습니다. 앱이 오래된 데이터를 보여주는 일은 이제 없어집니다
Realm 객체는 항상 라이브입니다. 즉 언제나 최신의 데이터를 유지하고 있습니다. 데이터가 수정되면 알림을 받아 UI를 업데이트 할 수 있습니다. 앱이 오래된 데이터를 보여주는 일은 이제 없어집니다
// Authenticating the User
Realm.Sync.User.registerWithProvider('http://realm.example.co:9080', 'google', googleAccessToken, (error, user) => {
if (!error) {
// Opening a remote Realm
var realm = new Realm({
sync: {
user: user,
url: 'realm://realm.example.co:9080/~/userRealm',
}
});
// Any changes made to this Realm will be synced across all devices!
}
})
// Authenticating the User
[RLMSyncUser logInWithCredentials:[RLMSyncCredentials credentialsWithGoogleToken:@"google token"]
authServerURL:[NSURL URLWithString:@"http://realm.example.com:9080"]
onCompletion:^(RLMSyncUser *user, NSError *error) {
if (user) {
// Opening a remote Realm
NSURL *realmURL = [NSURL URLWithString:@"realm://realm.example.com:9080/~/userRealm"];
RLMRealmConfiguration *config = [[RLMRealmConfiguration alloc] init];
config.syncConfiguration = [[RLMSyncConfiguration alloc] initWithUser:user realmURL:realmURL];
RLMRealm *realm = [RLMRealm realmWithConfiguration:config error:nil];
// Any changes made to this Realm will be synced across all devices!
} else if (error) {
// handle error
}
}];
// Authenticating the User
SyncUser.logIn(with: .google(token: "google token"),
server: URL(string: "http://realm.example.com:9080")!) { user, error in
if let user = user {
// Opening a remote Realm
let realmURL = URL(string: "realm://realm.example.com:9080/~/userRealm")!
let realm = try! Realm(configuration: user.configuration())
// Any changes made to this Realm will be synced across all devices!
} else if let error = error {
// handle error
}
}
// Authenticating the User
User user = User.login(Credentials.google("google token"),
"http://realm.example.com:9080/auth");
// Opening a remote Realm
String realmURL = "realm://realm.example.com:9080/~/userRealm";
Realm realm = Realm.getInstance(user.configuration());
// Any changes made to this Realm will be synced across all devices!
var user = await User.LoginAsync(Credentials.Google("google token"),
new Uri("http://realm.example.com:9080"));
var realmUrl = new Uri("realm://realm.example.com:9080/~/userRealm");
var realm = Realm.GetInstance(user.configuration());
// Any changes made to this Realm will be synced across all devices!
데이터를 언제나 동기화하세요 Realm 플랫폼을 사용하여 Realm 데이터베이스를 Realm 오브젝트 서버와 완전하게 같이 동작하게 할 수 있습니다. Realm 오브젝트 서버의 URL을 설정하기만 하면 나머지는 로컬 데이터베이스를 사용하는 것과 똑같이 사용하면 됩니다. 데이터는 저장될 때마다 자동으로 동기화될 것이고, 추가로 해줄 작업은 없습니다.
Realm Java, Realm Objective‑C & Realm Swift, Realm JavaScript와 Realm Xamarin 모두에서 사용할 수 있습니다.
Realm 플랫폼을 사용하여 Realm 데이터베이스를 Realm 오브젝트 서버와 완전하게 같이 동작하게 할 수 있습니다. Realm 오브젝트 서버의 URL을 설정하기만 하면 나머지는 로컬 데이터베이스를 사용하는 것과 똑같이 사용하면 됩니다. 데이터는 저장될 때마다 자동으로 동기화될 것이고, 추가로 해줄 작업은 없습니다.
Realm Java, Realm Objective‑C & Realm Swift, Realm JavaScript와 Realm Xamarin 모두에서 사용할 수 있습니다.
모바일을 위해 만들어진 데이터베이스 장점
Realm 스튜디오
Realm 스튜디오는 Realm을 사용기위한 무료 개발도구 입니다. 깔끔한 인터페이스로 Realm 플랫폼과 Realm 데이터베이스를 사용해서 쉽게 개발하고 관리할 수 있습니다. Realm 오브젝트 서버의 현재 업속 숫자, 사용되고있는 Realm, 트래픽 볼륨등을 한눈에 확인햅 볼 수 있습니다. 또한, Realm을 실시간을 확인할 수 있기 때문에 쉽게 내용을 보고 .realm 파일을 디버깅 할 수 있습니다. 이러한 기능을 덕분에 Realm 스튜디오는 개발자들이 더 나은 앱을 더 빨리 개발할 수 있도록 도와주는 핵심적인 도구중 하나입니다.
Read a Whitepaper
Learn about Realm's best practices, approach to identity, access control, auditing and logging and encryption. Check out some of our whitepapers below.
Read moreTry a Demo
Learn how to get a synchronized Realm up and running with just 20 lines of code, and discover the power of server-side event handling in a simple demo.
Try a DemoWatch a Webinar
Get a clear and practical overview of the Realm Platform and its top use cases in these presentations and demos.
Watch nowGet Started with Realm
Trusted by Fortune 500 mainstays, innovative startups, and #1-ranked app store successes

Me using @realm for the first time: 'this CAN’T be that easy. Pretty sure I’m missing something.'
Marco Sero
iOS Engineer @ Google

I boosted my database of 200,000 rows search from 7 seconds to 0.5 seconds with @realm . Practically under 30 mins of using it 1st time.
Vijaya P. Kandel
iOS Engineer

Very impressive! I’m a huge fan of innovative solutions—especially critical processes like data persistence. 💯
Kevin Hoctor
Software Engineer @ Apple